Modifier and Type | Method and Description |
---|---|
static <K,V> Map.Entry<K,V> |
immutableEntry(K key,
V value)
Returns an immutable map entry with the specified key and value.
|
static <K,V> HashMap<K,V> |
newHashMap()
Creates a
HashMap instance. |
static <K,V> IdentityHashMap<K,V> |
newIdentityHashMap()
Creates an
IdentityHashMap instance. |
static <K,V> LinkedHashMap<K,V> |
newLinkedHashMap()
Creates an insertion-ordered
LinkedHashMap instance. |
static <K extends Comparable,V> |
newTreeMap()
Creates a
TreeMap instance using the natural ordering of its
elements. |
public static <K,V> HashMap<K,V> newHashMap()
HashMap
instance.
Note: if you don't actually need the resulting map to be mutable,
use Collections.emptyMap()
instead.
HashMap
public static <K,V> LinkedHashMap<K,V> newLinkedHashMap()
LinkedHashMap
instance.LinkedHashMap
public static <K extends Comparable,V> TreeMap<K,V> newTreeMap()
TreeMap
instance using the natural ordering of its
elements.TreeMap
public static <K,V> IdentityHashMap<K,V> newIdentityHashMap()
IdentityHashMap
instance.IdentityHashMap
public static <K,V> Map.Entry<K,V> immutableEntry(@Nullable K key, @Nullable V value)
Map.Entry.setValue(V)
operation throws an UnsupportedOperationException
.
The returned entry is serializable.
key
- the key to be associated with the returned entryvalue
- the value to be associated with the returned entryCopyright © 2006-2012 Google, Inc.. All Rights Reserved.