Class FlushablePool<T>

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.badlogic.gdx.utils.Pool

        Pool.Poolable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Array<T> obtained  
      • Fields inherited from class com.badlogic.gdx.utils.Pool

        max, peak
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()
      Frees all obtained instances.
      void free​(T object)
      Puts the specified object in the pool, making it eligible to be returned by Pool.obtain().
      void freeAll​(Array<T> objects)
      Puts the specified objects in the pool.
      T obtain()
      Returns an object from this pool.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • obtained

        protected Array<T> obtained
    • Constructor Detail

      • FlushablePool

        public FlushablePool()
      • FlushablePool

        public FlushablePool​(int initialCapacity)
      • FlushablePool

        public FlushablePool​(int initialCapacity,
                             int max)
    • Method Detail

      • 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:
        Pool.free(Object)