public final class IntList extends Object
Not thread-safe.
Constructor and Description |
---|
IntList()
Creates an empty
IntList object. |
IntList(int capacity)
Creates an
IntList object with initial capacity equal to capacity . |
Modifier and Type | Method and Description |
---|---|
IntList |
add(int i)
Adds
i into the array. |
void |
ensureCapacity(int capacity)
Ensures that there is at least
l capacity. |
int |
get(int i)
Gets the int value at a index
i . |
int |
set(int i,
int val)
Sets the value at index
i to val . |
int |
size()
Gets the number of int values stored.
|
int[] |
toArray()
Creates a
int[] object with all the elements. |
public IntList(int capacity)
IntList
object with initial capacity equal to capacity
.public IntList()
IntList
object.public int[] toArray()
int[]
object with all the elements.public int size()
public int get(int i)
i
.i
- the 0 - based index of the value.ArrayIndexOutOfBoundsException
- if i < 0 or i >= size()
.public int set(int i, int val)
i
to val
.i
- the 0 - based index.val
- the new value.ArrayIndexOutOfBoundsException
- if i < 0 or i >= size()
.public void ensureCapacity(int capacity)
l
capacity.capacity
- the minimal capacity.public IntList add(int i)
i
into the array.i
- the int value.Copyright © 2013–2016 jparsec. All rights reserved.