| Modifier and Type | Method and Description | 
|---|---|
static <K,V> ListMultimap<K,V> | 
newListMultimap(Map<K,Collection<V>> map,
               Supplier<? extends List<V>> factory)
Creates a new  
ListMultimap that uses the provided map and factory. | 
public static <K,V> ListMultimap<K,V> newListMultimap(Map<K,Collection<V>> map, Supplier<? extends List<V>> factory)
ListMultimap that uses the provided map and factory.
 It can generate a multimap based on arbitrary Map and List
 classes.
 
The factory-generated and map classes determine the
 multimap iteration order. They also specify the behavior of the
 equals, hashCode, and toString methods for the
 multimap and its returned views. The multimap's get, removeAll, and replaceValues methods return RandomAccess
 lists if the factory does. However, the multimap's get method
 returns instances of a different class than does factory.get().
 
The multimap is serializable if map, factory, the
 lists generated by factory, and the multimap contents are all
 serializable.
 
The multimap is not threadsafe when any concurrent operations update the
 multimap, even if map and the instances generated by
 factory are. Concurrent read operations will work correctly. To
 allow concurrent update operations, wrap the multimap with a call to
 #synchronizedListMultimap.
 
Call this method only when the simpler methods
 ArrayListMultimap#create() and LinkedListMultimap#create()
 won't suffice.
 
Note: the multimap assumes complete ownership over of map and
 the lists returned by factory. Those objects should not be manually
 updated, they should be empty when provided, and they should not use soft,
 weak, or phantom references.
map - place to store the mapping from each key to its corresponding
                valuesfactory - supplier of new, empty lists that will each hold all values
                for a given keyIllegalArgumentException - if map is not emptyCopyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.