Class SimpleConcurrentBidiMap<K,V>

java.lang.Object
com.levigo.jadice.web.server.util.SimpleConcurrentBidiMap<K,V>
Type Parameters:
K -
V -

public class SimpleConcurrentBidiMap<K,V> extends Object
A simple implementation of a concurrent bidirectional map. Currently, only remove and overwrite operations are supported.
  • Field Details

    • keyToValueMap

      protected final Map<K,V> keyToValueMap
    • valueToKeyMap

      protected final Map<V,K> valueToKeyMap
  • Constructor Details

    • SimpleConcurrentBidiMap

      public SimpleConcurrentBidiMap()
  • Method Details

    • upsert

      public V upsert(K key, V value)
      Inserts the value for the given key. Updates the value if the key is already present. Returns the previous value if present.
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      previous value if present
    • remove

      public V remove(K key)
      Removes the mapping for a key from this map if it is present (optional operation).
      Parameters:
      key - key whose mapping is to be removed from the map
      Returns:
      the previous value associated with key, or null if there was no mapping for key.
    • removeByValue

      public K removeByValue(V value)
      Removes the mapping for a value from this map if it is present (optional operation).
      Parameters:
      value - value that is to be removed from the map
      Returns:
      the previous key associated with value, or null if there was no mapping for value.