Class ArrayListMultimap<K,​V>

    • Constructor Detail

      • ArrayListMultimap

        private ArrayListMultimap()
      • ArrayListMultimap

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

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

      • create

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

        This method will soon be deprecated in favor of MultimapBuilder.hashKeys().arrayListValues().build().

      • create

        public static <K,​V> ArrayListMultimap<K,​V> create​(int expectedKeys,
                                                                      int expectedValuesPerKey)
        Constructs an empty ArrayListMultimap with enough capacity to hold the specified numbers of keys and values without resizing.

        This method will soon be deprecated in favor of MultimapBuilder.hashKeys(expectedKeys).arrayListValues(expectedValuesPerKey).build().

        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> ArrayListMultimap<K,​V> create​(Multimap<? extends K,​? extends V> multimap)
        Constructs an ArrayListMultimap with the same mappings as the specified multimap.

        This method will soon be deprecated in favor of MultimapBuilder.hashKeys().arrayListValues().build(multimap).

        Parameters:
        multimap - the multimap whose contents are copied to this multimap
      • createCollection

        java.util.List<V> createCollection()
        Creates a new, empty ArrayList to hold the collection of values for an arbitrary key.
        Specified by:
        createCollection in class AbstractListMultimap<K,​V>
        Returns:
        an empty collection of values
      • trimToSize

        @Deprecated
        public void trimToSize()
        Deprecated.
        For a ListMultimap that automatically trims to size, use ImmutableListMultimap. If you need a mutable collection, remove the trimToSize call, or switch to a HashMap<K, ArrayList<V>>.
        Reduces the memory used by this ArrayListMultimap, if feasible.
      • 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