Package org.eclipse.mat.collect
Class ArrayIntBig
- java.lang.Object
-
- org.eclipse.mat.collect.ArrayIntBig
-
- All Implemented Interfaces:
Serializable
public final class ArrayIntBig extends Object implements Serializable
This class simplifies the handling of growing int[] in a very fast and memory efficient manner so that no slow collections must be used. However this class is only fast on big int[] and not on small ones where you collect just a couple of ints. The internal data is never copied during the process of growing. Only withtoArray()the data is copied to the result int[].- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ArrayIntBig()Create anIntArray.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int element)Add int toIntArray.voidaddAll(int[] elements)Add int[] toIntArray.longconsumption()Get memory consumption ofIntArray.intget(int index)Get int at index fromIntArray.booleanisEmpty()Returnstrueif this list contains no elements.intlength()Get length ofIntArray.int[]toArray()ConvertIntArrayto int[].
-
-
-
Method Detail
-
add
public final void add(int element)
Add int toIntArray.- Parameters:
element- int which should be added
-
addAll
public final void addAll(int[] elements)
Add int[] toIntArray.- Parameters:
elements- int[] which should be added
-
get
public final int get(int index) throws IndexOutOfBoundsExceptionGet int at index fromIntArray.- Parameters:
index- index of int which should be returned- Returns:
- int at index
- Throws:
IndexOutOfBoundsException- if the index is beyond the end.
-
length
public final int length()
Get length ofIntArray.- Returns:
- length of
IntArray
-
isEmpty
public boolean isEmpty()
Returnstrueif this list contains no elements.- Returns:
trueif this list contains no elements.
-
consumption
public final long consumption()
Get memory consumption ofIntArray.- Returns:
- memory consumption of
IntArray
-
toArray
public final int[] toArray()
ConvertIntArrayto int[]. This operation is the only one where the internal data is copied. It is directly copied to the int[] which is returned, so don't call this method more than once when done.- Returns:
- int[] representing the
IntArray
-
-