Class HashMultimap<K,​V>

    • Constructor Detail

      • HashMultimap

        private HashMultimap()
      • HashMultimap

        private HashMultimap​(int expectedKeys,
                             int expectedValuesPerKey)
      • HashMultimap

        private HashMultimap​(Multimap<? extends K,​? extends V> multimap)
    • Method Detail

      • create

        public static <K,​V> HashMultimap<K,​V> create()
        Creates a new, empty HashMultimap with the default initial capacities.
      • create

        public static <K,​V> HashMultimap<K,​V> create​(int expectedKeys,
                                                                 int expectedValuesPerKey)
        Constructs an empty HashMultimap with enough capacity to hold the specified numbers of keys and values without rehashing.
        Parameters:
        expectedKeys - the expected number of distinct keys
        expectedValuesPerKey - the expected average number of values per key
        Throws:
        java.lang.IllegalArgumentException - if expectedKeys or expectedValuesPerKey is negative
      • create

        public static <K,​V> HashMultimap<K,​V> create​(Multimap<? extends K,​? extends V> multimap)
        Constructs a HashMultimap with the same mappings as the specified multimap. If a key-value mapping appears multiple times in the input multimap, it only appears once in the constructed multimap.
        Parameters:
        multimap - the multimap whose contents are copied to this multimap
      • createCollection

        java.util.Set<V> createCollection()
        Creates the collection of values for a single key.

        Collections with weak, soft, or phantom references are not supported. Each call to createCollection should create a new instance.

        The returned collection class determines whether duplicate key-value pairs are allowed.

        Creates an empty HashSet for a collection of values for one key.

        Specified by:
        createCollection in class AbstractSetMultimap<K,​V>
        Returns:
        a new HashSet containing a collection of values for one key
      • writeObject

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

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