Class ExtendedMap<K,V>

Type Parameters:
K - key type
V - value type
All Implemented Interfaces:
Serializable, ConcurrentMap<K,V>, Map<K,V>

public class ExtendedMap<K,V> extends ConcurrentHashMap<K,V>
Class to implement ExtendedMap
See Also:
  • Constructor Details

    • ExtendedMap

      public ExtendedMap()
      Constructor
    • ExtendedMap

      public ExtendedMap(int initialCapacity)
      Constructor
      Parameters:
      initialCapacity - initialCapacity
    • ExtendedMap

      public ExtendedMap(Map<? extends K,? extends V> m)
      Constructor
      Parameters:
      m - m
    • ExtendedMap

      public ExtendedMap(int initialCapacity, float loadFactor)
      Constructor
      Parameters:
      initialCapacity - initialCapacity
      loadFactor - loadFactor
    • ExtendedMap

      public ExtendedMap(int initialCapacity, float loadFactor, int concurrencyLevel)
      Constructor
      Parameters:
      initialCapacity - initialCapacity
      loadFactor - loadFactor
      concurrencyLevel - concurrencyLevel
  • Method Details

    • getAs

      public <T> T getAs(K key)
      Returns the value to which the specified key is mapped cast to the assigned type, or null if this map contains no mapping for the key.
      Type Parameters:
      T - the assigned type
      Parameters:
      key - key
      Returns:
      the value to which the specified key is mapped cast to the assigned type, or null if this map contains no mapping for the key
    • getAs

      public <T> T getAs(K key, Class<T> type)
      Returns the value to which the specified key is mapped cast to the requested type, or null if this map contains no mapping for the key.
      Type Parameters:
      T - the requested type
      Parameters:
      key - key
      type - type
      Returns:
      the value to which the specified key is mapped cast to the requested type, or null if this map contains no mapping for the key
    • removeAs

      public <T> T removeAs(K key)
      Removes the mapping for a key from this map if it is present, casting to the assigned type.
      Type Parameters:
      T - the assigned type
      Parameters:
      key - key
      Returns:
      the previous value associated with key cast to the assigned type, or null if there was no mapping for key
    • removeAs

      public <T> T removeAs(K key, Class<T> type)
      Removes the mapping for a key from this map if it is present, casting to the requested type.
      Type Parameters:
      T - the assigned type
      Parameters:
      key - key
      type - type
      Returns:
      the previous value associated with key cast to the requested type, or null if there was no mapping for key