Class SynchronizedIdentityMap<K,V>

java.lang.Object
com.pnfsoftware.jeb.util.collect.SynchronizedIdentityMap<K,V>
Type Parameters:
K - key type
V - value type

@Ser public class SynchronizedIdentityMap<K,V> extends Object
A serializable, inefficient, fully synchronized, identity pseudo-map.

See SynchronizedLinkedMap for details and caveats.

  • Constructor Details

    • SynchronizedIdentityMap

      public SynchronizedIdentityMap()
      Create an empty synchronized identity map.
  • Method Details

    • size

      public int size()
      Returns:
      number of mappings
    • clear

      public void clear()
      Remove all mappings.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if no mapping exists
    • containsKey

      public boolean containsKey(K key)
      Parameters:
      key - key
      Returns:
      true if the key is present
    • containsValue

      public boolean containsValue(V value)
      Parameters:
      value - value
      Returns:
      true if the value is present
    • get

      public V get(K key)
      Parameters:
      key - key
      Returns:
      value associated with the key, or null
    • put

      public V put(K key, V value)
      Add or replace a mapping.
      Parameters:
      key - non-null key
      value - non-null value
      Returns:
      previous value, or null
    • remove

      public V remove(K key)
      Remove a mapping.
      Parameters:
      key - key
      Returns:
      removed value, or null
    • copyOfKeys

      public Set<K> copyOfKeys()
      Copy the current keys.
      Returns:
      copy of the key set
    • firstKey

      public K firstKey()
      Returns:
      first key in iteration order
      Throws:
      NoSuchElementException - if the map is empty
    • toString

      public String toString()
      Overrides:
      toString in class Object