|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjfun.util.IntArray
public final class IntArray
A simple, efficient and dynamic int array.
Constructor Summary | |
---|---|
IntArray()
Create an IntArray object. |
|
IntArray(int capacity)
Create an IntArray object with an initial capacity. |
Method Summary | |
---|---|
IntArray |
add(int i)
Add a int into the array. |
void |
ensureCapacity(int capacity)
Ensure that the IntArray has at least "l" capacity. |
int |
get(int i)
Get the int value at a certain index. |
int |
set(int i,
int val)
Set the value at a certain index. |
int |
size()
Get the number of int values stored. |
int[] |
toArray()
Create a int[] object with all the elements stored in this IntArray. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IntArray(int capacity)
capacity
- the initial capacity.public IntArray()
Method Detail |
---|
public int[] toArray()
public int size()
public int get(int i)
i
- the 0-based index of the value.
java.lang.ArrayIndexOutOfBoundsException
- if i is negative or >= size().public int set(int i, int val)
i
- the 0-based index.val
- the new value.
java.lang.ArrayIndexOutOfBoundsException
- if i is negative or >= size().public void ensureCapacity(int capacity)
capacity
- the minimal capacity.public IntArray add(int i)
i
- the int value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |