Package org.h2.util
Class IntArray
java.lang.Object
org.h2.util.IntArray
An array with integer element.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int value) Append a value.voidensureCapacity(int minCapacity) Ensure the underlying array is large enough for the given number of entries.booleanintget(int index) Get the value at the given index.inthashCode()voidremove(int index) Remove the value at the given index.voidremoveRange(int fromIndex, int toIndex) Remove a number of elements.intsize()Get the size of the list.voidtoArray(int[] array) Convert this list to an array.toString()
-
Constructor Details
-
IntArray
public IntArray()Create an int array with the default initial capacity. -
IntArray
public IntArray(int capacity) Create an int array with specified initial capacity.- Parameters:
capacity- the initial capacity
-
IntArray
public IntArray(int[] data) Create an int array with the given values and size.- Parameters:
data- the int array
-
-
Method Details
-
add
public void add(int value) Append a value.- Parameters:
value- the value to append
-
get
public int get(int index) Get the value at the given index.- Parameters:
index- the index- Returns:
- the value
-
remove
public void remove(int index) Remove the value at the given index.- Parameters:
index- the index
-
ensureCapacity
public void ensureCapacity(int minCapacity) Ensure the underlying array is large enough for the given number of entries.- Parameters:
minCapacity- the minimum capacity
-
equals
-
hashCode
public int hashCode() -
size
public int size()Get the size of the list.- Returns:
- the size
-
toArray
public void toArray(int[] array) Convert this list to an array. The target array must be big enough.- Parameters:
array- the target array
-
toString
-
removeRange
public void removeRange(int fromIndex, int toIndex) Remove a number of elements.- Parameters:
fromIndex- the index of the first item to removetoIndex- upper bound (exclusive)
-