@GwtCompatible(serializable=true, emulated=true) public abstract class ImmutableMap<K,V> extends Object implements Map<K,V>, Serializable
Map whose contents will never change, with many other important properties detailed at
ImmutableCollection.
See the Guava User Guide article on immutable collections.
| Constructor and Description |
|---|
ImmutableMap() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> ImmutableMap<K,V> |
copyOf(Map<? extends K,? extends V> map)
Returns an immutable map containing the same entries as
map. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic static <K,V> ImmutableMap<K,V> copyOf(Map<? extends K,? extends V> map)
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.
NullPointerException - if any key or value in map is nullCopyright © 2007-2022. All Rights Reserved.