Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CAPACITY |
Constructor and Description |
---|
ArrayIntList()
Initializes a new empty list with initial capacity of DEFAULT_CAPACITY integers.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Appends value to the end of the list.
|
int |
get(int index)
Returns the value at index.
|
Iterator<Integer> |
iterator()
Returns a new iterator for the list
|
int |
numberOfEvens() |
void |
remove(int index)
Removes the value at the given index, shifting later values over.
|
boolean |
search(int value) |
void |
set(int index,
int value)
Sets the data at index to value.
|
int |
size()
Returns the number of elements in the list.
|
String |
toString()
Returns a String representation of the list consisting of the elements
in order, separated by commas and enclosed in square brackets.
|
public static final int DEFAULT_CAPACITY
public ArrayIntList()
public int numberOfEvens()
public boolean search(int value)
public void add(int value)
add
in interface IntList
public int get(int index)
get
in interface IntList
public void set(int index, int value)
set
in interface IntList
public void remove(int index)
remove
in interface IntList
public int size()
size
in interface IntList