Interface Pool<V>

All Known Implementing Classes:
AbstractUnifiedSet, UnifiedSet, UnifiedSetWithHashingStrategy

public interface Pool<V>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    get(V key)
    Locates an object in the pool which is equal to key.
    put(V key)
    Puts key into the pool.
    Locates an object in the pool which is equal to key and removes it.
    int
     
  • Method Details

    • get

      V get(V key)
      Locates an object in the pool which is equal to key.
      Parameters:
      key - the value to look for
      Returns:
      The object reference in the pool equal to key or null.
    • clear

      void clear()
    • put

      V put(V key)
      Puts key into the pool. If there is no existing object that is equal to key, key will be added to the pool and the return value will be the same instance. If there is an existing object in the pool that is equal to key, the pool will remain unchanged and the pooled instance will be is returned.
      Parameters:
      key - the value to add if not in the pool
      Returns:
      the object reference in the pool equal to key (either key itself or the existing reference)
    • size

      int size()
    • removeFromPool

      V removeFromPool(V key)
      Locates an object in the pool which is equal to key and removes it.
      Parameters:
      key - object to remove
      Returns:
      The object reference in the pool equal to key or null.