Files
2016-04-27 01:07:35 -04:00

781 lines
36 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:11 EDT 2016 -->
<title>IntList (Parallel Java 2 Library Documentation)</title>
<meta name="date" content="2016-04-06">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="IntList (Parallel Java 2 Library Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/IntList.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/util/IntActionResult.html" title="interface in edu.rit.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/util/IntList.html" target="_top">Frames</a></li>
<li><a href="IntList.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.rit.util</div>
<h2 title="Class IntList" class="title">Class IntList</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>edu.rit.util.IntList</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">IntList</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></pre>
<div class="block">Class IntList provides a list of integers (type <TT>int</TT>) stored in a
dynamically-sized array.
<P>
Operations take constant time unless otherwise specified. <I>n</I> is the
number of items stored in the list.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../edu/rit/util/IntList.html#IntList()">IntList</a></strong>()</code>
<div class="block">Construct a new list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../edu/rit/util/IntList.html#IntList(edu.rit.util.IntList)">IntList</a></strong>(<a href="../../../edu/rit/util/IntList.html" title="class in edu.rit.util">IntList</a>&nbsp;list)</code>
<div class="block">Construct a new list that is a copy of the given list.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#add(int, int)">add</a></strong>(int&nbsp;p,
int&nbsp;i)</code>
<div class="block">Add the given item to this list at the given position.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#addFirst(int)">addFirst</a></strong>(int&nbsp;i)</code>
<div class="block">Add the given item to the beginning of this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#addLast(int)">addLast</a></strong>(int&nbsp;i)</code>
<div class="block">Add the given item to the end of this list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#clear()">clear</a></strong>()</code>
<div class="block">Clear this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#copy(edu.rit.util.IntList)">copy</a></strong>(<a href="../../../edu/rit/util/IntList.html" title="class in edu.rit.util">IntList</a>&nbsp;list)</code>
<div class="block">Set this list to a copy of the given list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#forEachItemDo(edu.rit.util.IntAction)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/IntAction.html" title="interface in edu.rit.util">IntAction</a>&nbsp;action)</code>
<div class="block">Perform the given action on each item in this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>&lt;R&gt;&nbsp;R</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#forEachItemDo(edu.rit.util.IntActionResult)">forEachItemDo</a></strong>(<a href="../../../edu/rit/util/IntActionResult.html" title="interface in edu.rit.util">IntActionResult</a>&lt;R&gt;&nbsp;action)</code>
<div class="block">Perform the given action on each item in this list and return a result.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#get(int)">get</a></strong>(int&nbsp;p)</code>
<div class="block">Get the item at the given position in this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#isEmpty()">isEmpty</a></strong>()</code>
<div class="block">Determine if this list is empty.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#position(int)">position</a></strong>(int&nbsp;i)</code>
<div class="block">Get the position of the given item in this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#position(edu.rit.util.IntPredicate)">position</a></strong>(<a href="../../../edu/rit/util/IntPredicate.html" title="interface in edu.rit.util">IntPredicate</a>&nbsp;predicate)</code>
<div class="block">Get the position of the first item in this list for which the given
predicate is true.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#readIn(edu.rit.io.InStream)">readIn</a></strong>(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a>&nbsp;in)</code>
<div class="block">Read this object's fields from the given in stream.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#remove(int)">remove</a></strong>(int&nbsp;p)</code>
<div class="block">Remove the item at the given position in this list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#removeEachItemIf(edu.rit.util.IntPredicate)">removeEachItemIf</a></strong>(<a href="../../../edu/rit/util/IntPredicate.html" title="interface in edu.rit.util">IntPredicate</a>&nbsp;predicate)</code>
<div class="block">Evaluate the given predicate on, and possibly remove, each item in this
list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#removeFirst()">removeFirst</a></strong>()</code>
<div class="block">Remove the item at the beginning of this list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#removeLast()">removeLast</a></strong>()</code>
<div class="block">Remove the item at the end of this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#set(int, int)">set</a></strong>(int&nbsp;p,
int&nbsp;i)</code>
<div class="block">Set the item at the given position in this list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#size()">size</a></strong>()</code>
<div class="block">Returns the number of items in this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#swap(int, int)">swap</a></strong>(int&nbsp;p,
int&nbsp;q)</code>
<div class="block">Swap the items at the given positions in this list.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#swapRemoveLast(int)">swapRemoveLast</a></strong>(int&nbsp;p)</code>
<div class="block">Swap the item at the given position with the item at the end of this
list, then remove the item at the end of this list.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#toArray(int[])">toArray</a></strong>(int[]&nbsp;array)</code>
<div class="block">Store this list's items in the given array.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#toArray(int[], int, int)">toArray</a></strong>(int[]&nbsp;array,
int&nbsp;off,
int&nbsp;len)</code>
<div class="block">Store this list's items in the given array.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/util/IntList.html#writeOut(edu.rit.io.OutStream)">writeOut</a></strong>(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a>&nbsp;out)</code>
<div class="block">Write this object's fields to the given out stream.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="IntList()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>IntList</h4>
<pre>public&nbsp;IntList()</pre>
<div class="block">Construct a new list.</div>
</li>
</ul>
<a name="IntList(edu.rit.util.IntList)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>IntList</h4>
<pre>public&nbsp;IntList(<a href="../../../edu/rit/util/IntList.html" title="class in edu.rit.util">IntList</a>&nbsp;list)</pre>
<div class="block">Construct a new list that is a copy of the given list. The new list's
entries contain the same items in the same order as the given list. Time:
<I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>list</code> - List to copy.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="isEmpty()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEmpty</h4>
<pre>public&nbsp;boolean&nbsp;isEmpty()</pre>
<div class="block">Determine if this list is empty.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if this list is empty, false if it isn't.</dd></dl>
</li>
</ul>
<a name="clear()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public&nbsp;void&nbsp;clear()</pre>
<div class="block">Clear this list.</div>
</li>
</ul>
<a name="copy(edu.rit.util.IntList)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copy</h4>
<pre>public&nbsp;void&nbsp;copy(<a href="../../../edu/rit/util/IntList.html" title="class in edu.rit.util">IntList</a>&nbsp;list)</pre>
<div class="block">Set this list to a copy of the given list. Afterwards, this list contains
the same items in the same order as the given list. Time:
<I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>list</code> - List to copy.</dd></dl>
</li>
</ul>
<a name="size()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public&nbsp;int&nbsp;size()</pre>
<div class="block">Returns the number of items in this list.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Number of items.</dd></dl>
</li>
</ul>
<a name="get(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;int&nbsp;get(int&nbsp;p)</pre>
<div class="block">Get the item at the given position in this list.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - Position, in the range 0 .. <TT>size()</TT>&minus;1.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Item stored at position <TT>p</TT>.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>p</TT> is out of bounds.</dd></dl>
</li>
</ul>
<a name="set(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre>public&nbsp;void&nbsp;set(int&nbsp;p,
int&nbsp;i)</pre>
<div class="block">Set the item at the given position in this list.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - Position, in the range 0 .. <TT>size()</TT>&minus;1.</dd><dd><code>i</code> - Item to store at position <TT>p</TT>.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>p</TT> is out of bounds.</dd></dl>
</li>
</ul>
<a name="swap(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>swap</h4>
<pre>public&nbsp;void&nbsp;swap(int&nbsp;p,
int&nbsp;q)</pre>
<div class="block">Swap the items at the given positions in this list.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - First item position, in the range 0 ..
<TT>size()</TT>&minus;1.</dd><dd><code>q</code> - Second item position, in the range 0 ..
<TT>size()</TT>&minus;1.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>p</TT> or <TT>q</TT> is out of
bounds.</dd></dl>
</li>
</ul>
<a name="position(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>position</h4>
<pre>public&nbsp;int&nbsp;position(int&nbsp;i)</pre>
<div class="block">Get the position of the given item in this list. This involves a linear
scan of the list items starting from the beginning of the list; the
position of the first item encountered that is equal to the given item is
returned; if there is no such item, &minus;1 is returned. Time:
<I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - Item.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Position of <TT>i</TT> in the range 0 ..
<TT>size()</TT>&minus;1, or &minus;1 if none.</dd></dl>
</li>
</ul>
<a name="position(edu.rit.util.IntPredicate)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>position</h4>
<pre>public&nbsp;int&nbsp;position(<a href="../../../edu/rit/util/IntPredicate.html" title="interface in edu.rit.util">IntPredicate</a>&nbsp;predicate)</pre>
<div class="block">Get the position of the first item in this list for which the given
predicate is true. This involves a linear scan of the list items starting
from the beginning of the list; the returned value is the position of the
first item encountered for which the predicate's <TT>test()</TT> method
returns true; if there is no such item, &minus;1 is returned. Time:
<I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>predicate</code> - Predicate.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Position of matching item in the range 0 ..
<TT>size()</TT>&minus;1, or &minus;1 if none.</dd></dl>
</li>
</ul>
<a name="addLast(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addLast</h4>
<pre>public&nbsp;int&nbsp;addLast(int&nbsp;i)</pre>
<div class="block">Add the given item to the end of this list. This list's size increases by
1.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - Item.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Newly added item.</dd></dl>
</li>
</ul>
<a name="addFirst(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addFirst</h4>
<pre>public&nbsp;int&nbsp;addFirst(int&nbsp;i)</pre>
<div class="block">Add the given item to the beginning of this list. Items at position 0 and
beyond are moved forward one position. This list's size increases by 1.
Time: <I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - Item.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Newly added item.</dd></dl>
</li>
</ul>
<a name="add(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;int&nbsp;add(int&nbsp;p,
int&nbsp;i)</pre>
<div class="block">Add the given item to this list at the given position. Items at position
<TT>p</TT> and beyond are moved forward one position. This list's size
increases by 1. Time: <I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - Position, in the range 0 .. <TT>size()</TT>.</dd><dd><code>i</code> - Item.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Newly added item.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>p</TT> is out of bounds.</dd></dl>
</li>
</ul>
<a name="removeLast()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeLast</h4>
<pre>public&nbsp;int&nbsp;removeLast()</pre>
<div class="block">Remove the item at the end of this list. The removed item is returned.
This list's size decreases by 1. If this list is empty, nothing happens
and 0 is returned.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Removed item, or 0 if this list is empty.</dd></dl>
</li>
</ul>
<a name="removeFirst()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeFirst</h4>
<pre>public&nbsp;int&nbsp;removeFirst()</pre>
<div class="block">Remove the item at the beginning of this list. Items at position 1 and
beyond are moved backward one position. The removed item is returned.
This list's size decreases by 1. If this list is empty, nothing happens
and 0 is returned. Time: <I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Removed item, or 0 if this list is empty.</dd></dl>
</li>
</ul>
<a name="remove(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public&nbsp;int&nbsp;remove(int&nbsp;p)</pre>
<div class="block">Remove the item at the given position in this list. Items at position
<TT>p</TT>+1 and beyond are moved backward one position. The removed item
is returned. This list's size decreases by 1. If this list is empty,
nothing happens and 0 is returned. Time: <I>O</I>(<I>n</I>).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - Position, in the range 0 .. <TT>size()</TT>&minus;1.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Removed item, or 0 if this list is empty.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if this list is not empty and <TT>p</TT>
is out of bounds.</dd></dl>
</li>
</ul>
<a name="swapRemoveLast(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>swapRemoveLast</h4>
<pre>public&nbsp;int&nbsp;swapRemoveLast(int&nbsp;p)</pre>
<div class="block">Swap the item at the given position with the item at the end of this
list, then remove the item at the end of this list. The removed item,
which used to be at the given position, is returned. This list's size
decreases by 1.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>p</code> - Position, in the range 0 .. <TT>size()</TT>&minus;1.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Removed item.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>p</TT> is out of bounds.</dd></dl>
</li>
</ul>
<a name="forEachItemDo(edu.rit.util.IntAction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>forEachItemDo</h4>
<pre>public&nbsp;void&nbsp;forEachItemDo(<a href="../../../edu/rit/util/IntAction.html" title="interface in edu.rit.util">IntAction</a>&nbsp;action)</pre>
<div class="block">Perform the given action on each item in this list. For each item in this
list, the given <TT>action</TT>'s <TT>run()</TT> method is called,
passing in the item.
<P>
<B><I>Warning:</I></B> If the <TT>action</TT> adds items to or removes
items from the list, the <TT>forEachItemDo()</TT> method's behavior is
not specified.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>action</code> - Action.</dd></dl>
</li>
</ul>
<a name="forEachItemDo(edu.rit.util.IntActionResult)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>forEachItemDo</h4>
<pre>public&nbsp;&lt;R&gt;&nbsp;R&nbsp;forEachItemDo(<a href="../../../edu/rit/util/IntActionResult.html" title="interface in edu.rit.util">IntActionResult</a>&lt;R&gt;&nbsp;action)</pre>
<div class="block">Perform the given action on each item in this list and return a result.
For each item in this list, the given <TT>action</TT>'s <TT>run()</TT>
method is called, passing in the item. After all the list items have been
processed, the given <TT>action</TT>'s <TT>result()</TT> method is
called, and its result is returned.
<P>
<B><I>Warning:</I></B> If the <TT>action</TT> adds items to or removes
items from the list, the <TT>forEachItemDo()</TT> method's behavior is
not specified.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>R</code> - Result data type.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>action</code> - Action.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Result of processing all the list items.</dd></dl>
</li>
</ul>
<a name="removeEachItemIf(edu.rit.util.IntPredicate)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeEachItemIf</h4>
<pre>public&nbsp;void&nbsp;removeEachItemIf(<a href="../../../edu/rit/util/IntPredicate.html" title="interface in edu.rit.util">IntPredicate</a>&nbsp;predicate)</pre>
<div class="block">Evaluate the given predicate on, and possibly remove, each item in this
list. For each item in this list from beginning to end, the given
<TT>predicate</TT>'s <TT>test()</TT> method is called, passing in the
item. If the <TT>test()</TT> method returns true, the item is removed
from this list. Time: <I>O</I>(<I>n</I>).
<P>
<B><I>Warning:</I></B> If the <TT>predicate</TT> adds items to or removes
items from the list, other than by returning true, the
<TT>removeEachItemIf()</TT> method's behavior is not specified.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>predicate</code> - Predicate.</dd></dl>
</li>
</ul>
<a name="toArray(int[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre>public&nbsp;int[]&nbsp;toArray(int[]&nbsp;array)</pre>
<div class="block">Store this list's items in the given array. The first item is stored at
index 0, the second item at index 1, and so on. The number of array
elements set is <TT>array.length</TT>. If this list contains fewer than
<TT>array.length</TT> items, the remaining array elements are set to 0.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>array</code> - Array in which to store items.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The given array is returned.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>array</TT> is null.</dd></dl>
</li>
</ul>
<a name="toArray(int[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre>public&nbsp;int[]&nbsp;toArray(int[]&nbsp;array,
int&nbsp;off,
int&nbsp;len)</pre>
<div class="block">Store this list's items in the given array. The first item is stored at
index <TT>off</TT>, the second item at index <TT>off</TT>+1, and so on.
The number of array elements set is <TT>len</TT>. If this list contains
fewer than <TT>len</TT> items, the remaining array elements are set to 0.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>array</code> - Array in which to store items.</dd><dd><code>off</code> - Index at which to store first item.</dd><dd><code>len</code> - Number of items to store.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The given array is returned.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>array</TT> is null.</dd>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>off</TT> &lt; 0, <TT>len</TT>
&lt; 0, or <TT>off</TT>+<TT>len</TT> &gt; <TT>array.length</TT>.</dd></dl>
</li>
</ul>
<a name="writeOut(edu.rit.io.OutStream)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeOut</h4>
<pre>public&nbsp;void&nbsp;writeOut(<a href="../../../edu/rit/io/OutStream.html" title="class in edu.rit.io">OutStream</a>&nbsp;out)
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Write this object's fields to the given out stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/io/Streamable.html#writeOut(edu.rit.io.OutStream)">writeOut</a></code>&nbsp;in interface&nbsp;<code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>out</code> - Out stream.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd></dl>
</li>
</ul>
<a name="readIn(edu.rit.io.InStream)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>readIn</h4>
<pre>public&nbsp;void&nbsp;readIn(<a href="../../../edu/rit/io/InStream.html" title="class in edu.rit.io">InStream</a>&nbsp;in)
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Read this object's fields from the given in stream.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/io/Streamable.html#readIn(edu.rit.io.InStream)">readIn</a></code>&nbsp;in interface&nbsp;<code><a href="../../../edu/rit/io/Streamable.html" title="interface in edu.rit.io">Streamable</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>in</code> - In stream.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/IntList.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/util/IntActionResult.html" title="interface in edu.rit.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/util/IntPair.html" title="class in edu.rit.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/util/IntList.html" target="_top">Frames</a></li>
<li><a href="IntList.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><FONT SIZE="-2">Copyright &copy; 2013&ndash;2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">&#64;</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
</body>
</html>