A builder for creating immutable SetMultimap instances, especially public static final multimaps ("constant multimaps"). Example: static final Multimap STRING_TO_INTEGER_MULTIMAP = new ImmutableSetMultimap.Builder() .put("one", 1) .putAll("several", 1, 2, 3) .putAll("many", 1, 2, 3, 4, 5) .build(); Builder instances can be reused; it is safe to call #build multiple times to build multiple multimaps in series. Each multimap contains the key-value mappings in the previously created multimaps.
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.
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.
A builder for creating immutable bimap instances, especially public static final bimaps ("constant bimaps"). Example: static final ImmutableBiMap WORD_TO_INT = new ImmutableBiMap.Builder() .put("one", 1) .put("two", 2) .put("three", 3) .build(); For small immutable bimaps, the ImmutableBiMap.of() methods are even more convenient. By default, a Builder will generate bimaps that iterate over entries in the order they were inserted into the builder. For example, in the above example, WORD_TO_INT.entrySet() is guaranteed to iterate over the entries in the order "one"=1, "two"=2, "three"=3, and keySet() and values() respect the same order. If you want a different order, consider using orderEntriesByValue(Comparator<? super V> valueComparator), which changes this builder to sort entries by value. Builder instances can be reused - it is safe to call #build multiple times to build multiple bimaps in series. Each bimap is a superset of the bimaps created before it.
Returns the value from the right map (possibly null).
A builder for creating immutable sorted map instances, especially public static final maps ("constant maps"). Example: static final ImmutableSortedMap INT_TO_WORD = new ImmutableSortedMap.Builder(Ordering.natural()) .put(1, "one") .put(2, "two") .put(3, "three") .build(); For small immutable sorted maps, the ImmutableSortedMap.of() methods are even more convenient. Builder instances can be reused - it is safe to call #build multiple times to build multiple maps in series. Each map is a superset of the maps created before it.
A Multimap that cannot hold duplicate key-value pairs. Adding a key-value pair that's already in the multimap has no effect. See the Multimap<K,V> documentation for information common to all multimaps. The #get, #removeAll, and #replaceValues methods each return a Set of values, while #entries returns a Set of map entries. Though the method signature doesn't say so explicitly, the map returned by #asMap has Set values. If the values corresponding to a single key should be ordered according to a java.util.Comparator (or the natural order), see the SortedSetMultimap<K,V> subinterface. Since the value collections are sets, the behavior of a SetMultimap is not specified if key or value objects already present in the multimap change in a manner that affects equals comparisons. Use caution if mutable objects are used as keys or values in a SetMultimap. See the Guava User Guide article on Multimap.