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.
- This interface is not intended to be implemented by clients.
addReturns 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
newObject- the object to add
- a shared object that is equal to the given object or