Class FlushablePool<T>

java.lang.Object
com.badlogic.gdx.utils.Pool<T>
com.badlogic.gdx.utils.FlushablePool<T>
Direct Known Subclasses:
ModelBatch.RenderablePool

public abstract class FlushablePool<T> extends Pool<T>
A Pool which keeps track of the obtained items (see obtain()), which can be free'd all at once using the flush() method.
  • Field Details

    • obtained

      protected Array<T> obtained
  • Constructor Details

    • FlushablePool

      public FlushablePool()
    • FlushablePool

      public FlushablePool(int initialCapacity)
    • FlushablePool

      public FlushablePool(int initialCapacity, int max)
  • Method Details

    • obtain

      public T obtain()
      Description copied from class: Pool
      Returns an object from this pool. The object may be new (from Pool.newObject()) or reused (previously freed).
      Overrides:
      obtain in class Pool<T>
    • flush

      public void flush()
      Frees all obtained instances.
    • free

      public void free(T object)
      Description copied from class: Pool
      Puts the specified object in the pool, making it eligible to be returned by Pool.obtain(). If the pool already contains Pool.max free objects, the specified object is discarded, it is not reset and not added to the pool.

      The pool does not check if an object is already freed, so the same object must not be freed multiple times.

      Overrides:
      free in class Pool<T>
    • freeAll

      public void freeAll(Array<T> objects)
      Description copied from class: Pool
      Puts the specified objects in the pool. Null objects within the array are silently ignored.

      The pool does not check if an object is already freed, so the same object must not be freed multiple times.

      Overrides:
      freeAll in class Pool<T>
      See Also: