Package org.eclipse.mat.collect
Class ArrayLongBig
- java.lang.Object
-
- org.eclipse.mat.collect.ArrayLongBig
-
public final class ArrayLongBig extends java.lang.ObjectThis class simplifies the handling of growing long[] in a very fast and memory efficient manner so that no slow collections must be used. However this class is only fast on big long[] and not on small ones where you collect just a couple of longs. The internal data is never copied during the process of growing. Only withtoArray()the data is copied to the result long[].
-
-
Constructor Summary
Constructors Constructor Description ArrayLongBig()Create anLongArray.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long element)Add long toLongArray.voidaddAll(long[] elements)Add long[] toLongArray.longconsumption()Get memory consumption ofLongArray.longget(int index)Get long at index fromLongArray.intlength()Get length ofLongArray.long[]toArray()ConvertLongArrayto long[].
-
-
-
Method Detail
-
add
public final void add(long element)
Add long toLongArray.- Parameters:
element- long which should be added
-
addAll
public final void addAll(long[] elements)
Add long[] toLongArray.- Parameters:
elements- long[] which should be added
-
get
public final long get(int index) throws java.lang.IndexOutOfBoundsExceptionGet long at index fromLongArray.- Parameters:
index- index of long which should be returned- Returns:
- long at index
- Throws:
java.lang.IndexOutOfBoundsException- if the index is beyond the end.
-
length
public final int length()
Get length ofLongArray.- Returns:
- length of
LongArray
-
consumption
public final long consumption()
Get memory consumption ofLongArray.- Returns:
- memory consumption of
LongArray
-
toArray
public final long[] toArray()
ConvertLongArrayto long[]. This operation is the only one where the internal data is copied. It is directly copied to the long[] which is returned, so don't call this method more than once when done.- Returns:
- long[] representing the
LongArray
-
-