public final class ArrayInt extends Object
| Constructor and Description |
|---|
ArrayInt()
Create a list of default size
|
ArrayInt(ArrayInt template)
Create a list based on an existing ArrayInt, of size of the template
|
ArrayInt(int initialCapacity)
Create an empty list of given capacity for more entries.
|
ArrayInt(int[] initialValues)
Create a list based on a supplied array
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int element)
append one more entry
|
void |
addAll(ArrayInt template)
Append all of another ArrayInt to the end of this one.
|
void |
addAll(int[] elements)
Append a group of entries
|
void |
clear()
clear all the entries
|
int |
firstElement()
get the first entry to be written.
|
int |
get(int index)
Retrieve one entry
|
boolean |
isEmpty()
is the list empty
|
IteratorInt |
iterator()
get an iterator to go through the list
|
int |
lastElement()
get the last entry to be written.
|
int |
set(int index,
int element)
modify one particular entry
|
int |
size()
get the number of used entries
|
void |
sort()
arrange the entries in ascending order
|
int[] |
toArray()
convert to an array
|
public ArrayInt()
public ArrayInt(int initialCapacity)
initialCapacity - in number of entriespublic ArrayInt(int[] initialValues)
initialValues - a copy is taken of this arraypublic ArrayInt(ArrayInt template)
template - a copy is taken of these valuespublic void add(int element)
element - the int to add to the endpublic void addAll(int[] elements)
elements - an array of int, to be added to end of this ArrayInt.public void addAll(ArrayInt template)
template - the other ArrayIntpublic int set(int index,
int element)
index - into this ArrayIntelement - the new value to be put herepublic int get(int index)
index - into the ArrayIntpublic int size()
public int[] toArray()
public boolean isEmpty()
public IteratorInt iterator()
public void clear()
public int lastElement()
public int firstElement()
public void sort()