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 with toArray() the data is copied to the result int[].
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an IntArray.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(int element)
    Add int to IntArray.
    final void
    addAll(int[] elements)
    Add int[] to IntArray.
    final long
    Get memory consumption of IntArray.
    final int
    get(int index)
    Get int at index from IntArray.
    boolean
    Returns true if this list contains no elements.
    final int
    Get length of IntArray.
    final int[]
    Convert IntArray to int[].

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArrayIntBig

      public ArrayIntBig()
      Create an IntArray. Memory consumption is equal to creating a new ArrayList.
  • Method Details

    • add

      public final void add(int element)
      Add int to IntArray.
      Parameters:
      element - int which should be added
    • addAll

      public final void addAll(int[] elements)
      Add int[] to IntArray.
      Parameters:
      elements - int[] which should be added
    • get

      public final int get(int index) throws IndexOutOfBoundsException
      Get int at index from IntArray.
      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 of IntArray.
      Returns:
      length of IntArray
    • isEmpty

      public boolean isEmpty()
      Returns true if this list contains no elements.
      Returns:
      true if this list contains no elements.
    • consumption

      public final long consumption()
      Get memory consumption of IntArray.
      Returns:
      memory consumption of IntArray
    • toArray

      public final int[] toArray()
      Convert IntArray to 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