A map which forwards all its method calls to another map. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern. Warning: The methods of ForwardingMap forward indiscriminately to the methods of the delegate. For example, overriding #put alone will not change the behavior of #putAll, which can lead to unexpected behavior. In this case, you should override putAll as well, either providing your own implementation, or delegating to the provided standardPutAll method. default method warning: This class does not forward calls to default methods. Instead, it inherits their default implementations. When those implementations invoke methods, they invoke methods on the ForwardingMap. Each of the standard methods, where appropriate, use equal to test equality for both keys and values. This may not be the desired behavior for map implementations that use non-standard notions of key equality, such as a SortedMap whose comparator is not consistent with equals. The standard methods and the collection views they return are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.
An implementation of ListMultimap that supports deterministic iteration order for both keys and values. The iteration order is preserved across non-distinct key values. For example, for the following multimap definition: Multimap multimap = LinkedListMultimap.create(); multimap.put(key1, foo); multimap.put(key2, bar); multimap.put(key1, baz); ... the iteration order for #keys() is [key1, key2, key1], and similarly for entries(). Unlike LinkedHashMultimap<K,V>, the iteration order is kept consistent between keys, entries and values. For example, calling: map.remove(key1, foo); changes the entries iteration order to [key2=bar, key1=baz] and the key iteration order to [key2, key1]. The entries() iterator returns mutable map entries, and #replaceValues attempts to preserve iteration order as much as possible. The collections returned by #keySet() and #asMap iterate through the keys in the order they were first added to the multimap. Similarly, #get, #removeAll, and #replaceValues return collections that iterate through the values in the order they were added. The collections generated by entries(), #keys(), and #values iterate across the key-value mappings in the order they were added to the multimap. The values() and entries() methods both return a List, instead of the Collection specified by the ListMultimap<K,V> interface. The methods #get, #keySet(), #keys(), #values, entries(), and #asMap return collections that are views of the multimap. If the multimap is modified while an iteration over any of those collections is in progress, except through the iterator's methods, the results of the iteration are undefined. Keys and values may be null. All optional multimap methods are supported, and all returned views are modifiable. This class is not threadsafe when any concurrent operations update the multimap. Concurrent read operations will work correctly. To allow concurrent update operations, wrap your multimap with a call to Multimaps#synchronizedListMultimap. See the Guava User Guide article on Multimap.
A BiMap backed by an EnumMap instance for keys-to-values, and a HashMap instance for values-to-keys. Null keys are not permitted, but null values are. An EnumHashBiMap and its inverse are both serializable. See the Guava User Guide article on BiMap.
Implementation of Multimap that uses an ArrayList to store the values for a given key. A HashMap associates each key with an ArrayList of values. When iterating through the collections supplied by this class, the ordering of values for a given key agrees with the order in which the values were added. This multimap allows duplicate key-value pairs. After adding a new key-value pair equal to an existing key-value pair, the ArrayListMultimap will contain entries for both the new value and the old value. Keys and values may be null. All optional multimap methods are supported, and all returned views are modifiable. The lists returned by #get, #removeAll, and #replaceValues all implement java.util.RandomAccess. This class is not threadsafe when any concurrent operations update the multimap. Concurrent read operations will work correctly. To allow concurrent update operations, wrap your multimap with a call to Multimaps#synchronizedListMultimap. See the Guava User Guide article on Multimap.