Class GrowArray<D>

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

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

    Constructors 
    Constructor Description
    GrowArray​(ConcurrencyOps.NewInstance<D> factory)  
    GrowArray​(ConcurrencyOps.NewInstance<D> factory, ConcurrencyOps.Reset<D> reset)  
  • Method Summary

    Modifier and Type Method Description
    D get​(int index)  
    D grow()
    Add a new element to the array.
    void reset()  
    void resize​(int length)
    Increases the size of the array so that it contains the specified number of elements.
    int size()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
    • get

      public D get​(int index)
    • size

      public int size()