org.sunflow.util
Class IntArray
java.lang.Object
org.sunflow.util.IntArray
public final class IntArray
extends java.lang.Object
void | add(int i) - Append an integer to the end of the array.
|
int | get(int index) - Read value from the array.
|
int | getSize() - Returns the number of elements added to the array.
|
void | set(int index, int value) - Write a value to the specified index.
|
int[] | trim() - Return a copy of the array, trimmed to fit the size of its contents
exactly.
|
IntArray
public IntArray()
IntArray
public IntArray(int capacity)
add
public final void add(int i)
Append an integer to the end of the array.
get
public final int get(int index)
Read value from the array.
index
- index into the array
- value at the specified index
getSize
public final int getSize()
Returns the number of elements added to the array.
- current size of the array
set
public final void set(int index,
int value)
Write a value to the specified index. Assumes the array is already big
enough.
trim
public final int[] trim()
Return a copy of the array, trimmed to fit the size of its contents
exactly.
- a new array of exactly the right length