|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingMap<K,V>
com.threerings.util.DefaultMap<K,V>
public class DefaultMap<K,V>
Provides a map implementation that automatically creates, and inserts into the map, a default
value for any value retrieved via the fetch(K) method which has no entry for that key.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Method Summary | ||
|---|---|---|
V |
fetch(K key)
Looks up the supplied key in the map, returning the value to which it is mapped. |
|
static
|
newHashMap(Function<K,V> creator)
Creates a default map backed by a HashMap using the supplied default creator. |
|
static
|
newInstanceCreator(Class<V> clazz)
Returns a Function that makes instances of the supplied class (using its no-args constructor) as default values. |
|
static
|
newInstanceHashMap(Class<V> clazz)
Creates a default map backed by a HashMap that creates instances of the supplied
class (using its no-args constructor) as defaults. |
|
static
|
newInstanceMap(Map<K,V> delegate,
Class<V> clazz)
Creates a default map backed by the supplied map that creates instances of the supplied class (using its no-args constructor) as defaults. |
|
static
|
newMap(Map<K,V> delegate,
Function<K,V> creator)
Creates a default map backed by the supplied map using the supplied default creator. |
|
| Methods inherited from class com.google.common.collect.ForwardingMap |
|---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class com.google.common.collect.ForwardingObject |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <K,V> DefaultMap<K,V> newInstanceHashMap(Class<V> clazz)
HashMap that creates instances of the supplied
class (using its no-args constructor) as defaults.
public static <K,V> DefaultMap<K,V> newInstanceMap(Map<K,V> delegate,
Class<V> clazz)
public static <K,V> Function<K,V> newInstanceCreator(Class<V> clazz)
public static <K,V> DefaultMap<K,V> newHashMap(Function<K,V> creator)
HashMap using the supplied default creator.
public static <K,V> DefaultMap<K,V> newMap(Map<K,V> delegate,
Function<K,V> creator)
public V fetch(K key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||