Class HashSetValuedHashMap<K,​V>

  • Type Parameters:
    K - the type of the keys in this map
    V - the type of the values in this map
    All Implemented Interfaces:
    java.io.Serializable, MultiValuedMap<K,​V>, SetValuedMap<K,​V>

    public class HashSetValuedHashMap<K,​V>
    extends AbstractSetValuedMap<K,​V>
    implements java.io.Serializable
    Implements a SetValuedMap, using a HashMap to provide data storage and HashSets as value collections. This is the standard implementation of a SetValuedMap.

    Note that HashSetValuedHashMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. This class may throw exceptions when accessed by concurrent threads without synchronization.

    Since:
    4.1
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serialization Version
        See Also:
        Constant Field Values
      • DEFAULT_INITIAL_MAP_CAPACITY

        private static final int DEFAULT_INITIAL_MAP_CAPACITY
        The initial map capacity used when none specified in constructor.
        See Also:
        Constant Field Values
      • DEFAULT_INITIAL_SET_CAPACITY

        private static final int DEFAULT_INITIAL_SET_CAPACITY
        The initial set capacity when using none specified in constructor.
        See Also:
        Constant Field Values
      • initialSetCapacity

        private final int initialSetCapacity
        The initial list capacity when creating a new value collection.
    • Constructor Detail

      • HashSetValuedHashMap

        public HashSetValuedHashMap()
        Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the default initial set capacity (3).
      • HashSetValuedHashMap

        public HashSetValuedHashMap​(int initialSetCapacity)
        Creates an empty HashSetValuedHashMap with the default initial map capacity (16) and the specified initial set capacity.
        Parameters:
        initialSetCapacity - the initial capacity used for value collections
      • HashSetValuedHashMap

        public HashSetValuedHashMap​(int initialMapCapacity,
                                    int initialSetCapacity)
        Creates an empty HashSetValuedHashMap with the specified initial map and list capacities.
        Parameters:
        initialMapCapacity - the initial hashmap capacity
        initialSetCapacity - the initial capacity used for value collections
      • HashSetValuedHashMap

        public HashSetValuedHashMap​(MultiValuedMap<? extends K,​? extends V> map)
        Creates an HashSetValuedHashMap copying all the mappings of the given map.
        Parameters:
        map - a MultiValuedMap to copy into this map
      • HashSetValuedHashMap

        public HashSetValuedHashMap​(java.util.Map<? extends K,​? extends V> map)
        Creates an HashSetValuedHashMap copying all the mappings of the given map.
        Parameters:
        map - a Map to copy into this map
    • Method Detail

      • writeObject

        private void writeObject​(java.io.ObjectOutputStream oos)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readObject

        private void readObject​(java.io.ObjectInputStream ois)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException