public class IntList extends PrimitiveList
Constructor and Description |
---|
IntList()
Constructs a new list.
|
IntList(int size)
Constructs a new list with a given initial capacity.
|
IntList(int[] array)
Constructs a new list initialised to the contents of a given array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Appends a value to the end of this list.
|
boolean |
addAll(int[] array)
Appends all the elements of a primitive array to this list.
|
boolean |
addAll(IntList other)
Appends all the elements of a second list to this list.
|
int |
get(int i)
Returns the element at a given position.
|
int[] |
getIntBuffer()
Returns the array currently used to store the contents of this list.
|
void |
set(int i,
int value)
Sets the element at a given position.
|
int[] |
toIntArray()
Returns the contents of this list as an array.
|
clear, nextCapacity, size, toArray
public IntList()
public IntList(int size)
size
- initial capacitypublic IntList(int[] array)
array
- array whose contents form initial contents of listpublic int get(int i)
i
- indexi
public void set(int i, int value)
i
- indexvalue
- new value for element i
public void add(int value)
value
- value to appendpublic boolean addAll(IntList other)
other
- other listpublic boolean addAll(int[] array)
array
- array to appendpublic int[] toIntArray()
public int[] getIntBuffer()