Class GrowArray<D>

java.lang.Object
pabeles.concurrency.GrowArray<D>

public class GrowArray<D> extends Object
An array of objects which grows and recycles its elements automatically.
  • Constructor Details

  • Method Details

    • reset

      public void reset()
    • resize

      public void resize(int length)
      Increases the size of the array so that it contains the specified number of elements. If the new length is bigger than the old size then reset is called on the new elements
    • grow

      public D grow()
      Add a new element to the array. Reset is called on it and it's then returned.
    • releaseInternalArray

      public void releaseInternalArray()
      Replaces the internal array with one of length zero.
    • get

      public D get(int index)
    • size

      public int size()