Class ImmutableMap<K,V>

java.lang.Object
org.docx4j.com.google.common.collect.ImmutableMap<K,V>
All Implemented Interfaces:
Serializable, Map<K,V>

@GwtCompatible(serializable=true, emulated=true) public abstract class ImmutableMap<K,V> extends Object implements Map<K,V>, Serializable
A Map whose contents will never change, with many other important properties detailed at ImmutableCollection.

See the Guava User Guide article on immutable collections.

Since:
2.0
Author:
Jesse Wilson, Kevin Bourrillion
See Also:
  • Constructor Details

    • ImmutableMap

      public ImmutableMap()
  • Method Details

    • copyOf

      public static <K, V> ImmutableMap<K,V> copyOf(Map<? extends K,? extends V> map)
      Returns an immutable map containing the same entries as map. The returned map iterates over entries in the same order as the entrySet of the original map. If map somehow contains entries with duplicate keys (for example, if it is a SortedMap whose comparator is not consistent with equals), the results of this method are undefined.

      Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.

      Throws:
      NullPointerException - if any key or value in map is null