Interface IPool<T>

  • All Known Implementing Classes:
    StrongPool, WeakPool

    public interface IPool<T>
    A Pool allows semantically equivalent objects to be shared. To be useful, objects added to the pool should implement a meaningful equals() method.

    Care must be taken by users that object sharing is appropriate for their application. It is easy to "over share" objects leading to unexpected and difficult to debug behaviour.

    This interface is not intended to be implemented by clients.

    Since:
    2.1
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T add​(T newObject)
      Returns the first object from this pool which is equal to the given object.
    • Method Detail

      • add

        T add​(T newObject)
        Returns the first object from this pool which is equal to the given object. If the pool contains no such object then the object is added to the pool and returned. If the object is null, null is returned.
        Parameters:
        newObject - the object to add
        Returns:
        a shared object that is equal to the given object or null