Class ImmutableMap<K,​V>

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

@GwtCompatible(serializable=true,
               emulated=true)
public abstract class ImmutableMap<K,​V>
extends java.lang.Object
implements java.util.Map<K,​V>, java.io.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:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from interface java.util.Map

    java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
  • Constructor Summary

    Constructors 
    Constructor Description
    ImmutableMap()  
  • Method Summary

    Modifier and Type Method Description
    static <K,​ V> ImmutableMap<K,​V> copyOf​(java.util.Map<? extends K,​? extends V> map)
    Returns an immutable map containing the same entries as map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Map

    clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
  • Constructor Details

  • Method Details

    • copyOf

      public static <K,​ V> ImmutableMap<K,​V> copyOf​(java.util.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:
      java.lang.NullPointerException - if any key or value in map is null