Package 

Interface ArrayPool


  • 
    public interface ArrayPool
    
                        

    Interface for an array pool that pools arrays of different types.

    • Method Summary

      Modifier and Type Method Description
      abstract <T> void put(T array, Class<T> arrayClass) Optionally adds the given array of the given type to the pool.
      abstract <T> void put(T array) Optionally adds the given array of the given type to the pool.
      abstract <T> T get(int size, Class<T> arrayClass) Returns a non-null array of the given type with a length >= to the given size.
      abstract <T> T getExact(int size, Class<T> arrayClass) Returns a non-null array of the given type with a length exactly equal to the given size.
      abstract void clearMemory() Clears all arrays from the pool.
      abstract void trimMemory(int level) Trims the size to the appropriate level.
      • Methods inherited from class java.lang.Object

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

      • put

        @Deprecated() abstract <T> void put(T array, Class<T> arrayClass)

        Optionally adds the given array of the given type to the pool.

        Arrays may be ignored, for example if the array is larger than the maximum size of the pool.

      • put

         abstract <T> void put(T array)

        Optionally adds the given array of the given type to the pool.

        Arrays may be ignored, for example if the array is larger than the maximum size of the pool.

      • get

         abstract <T> T get(int size, Class<T> arrayClass)

        Returns a non-null array of the given type with a length >= to the given size.

        If an array of the given size isn't in the pool, a new one will be allocated.

        This class makes no guarantees about the contents of the returned array.

      • getExact

         abstract <T> T getExact(int size, Class<T> arrayClass)

        Returns a non-null array of the given type with a length exactly equal to the given size.

        If an array of the given size isn't in the pool, a new one will be allocated.

        This class makes no guarantees about the contents of the returned array.

      • clearMemory

         abstract void clearMemory()

        Clears all arrays from the pool.