public class IntList
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Constructor and Description |
---|
IntList(int capacity)
Creates a new IntList with the given initial capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Adds the given int value to the list.
|
void |
clear()
Clears the list.
|
java.lang.Object |
clone() |
int |
get(int index)
Returns the value at the given index.
|
int |
peek() |
int |
pop() |
void |
push(int value) |
void |
set(int index,
int value)
Adds the given int value to the list.
|
int |
size()
Returns the number of elements in this list.
|
int[] |
toArray()
Copys the list contents into a new array.
|
public IntList(int capacity)
capacity
- the initial capacity.public void add(int value)
value
- the new value to be added.public void set(int index, int value)
value
- the new value to be added.public int get(int index)
index
- the indexjava.lang.IndexOutOfBoundsException
- if the index is greater or equal to the
list size or if the index is negative.public void clear()
public int size()
public int pop()
public int peek()
public final void push(int value)
public int[] toArray()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException