K - the key typeV - the value typepublic class ImnuMap<K,V> extends HashMap<K,V>
HashMap that specifies a default value for
keys that are not in the map. The default value is specified through an
interface called DefaultValue that defines one method: defaultValue.
defaultValue accepts the key as an argument, so an implementing
class can decide what default value should be returned based on the supplied
key.
While there are many ways of providing a default value for missing keys, the
name of this class enshrines the fact that the design of this particular
implementation was suggested by Himanshu Rathod. Specifically, {IMNU} = {HIMANSHU} -
{HASH}. In other words, ImnuMap is the difference between Himanshu's
suggestion and a plain ol' HashMap.| Modifier and Type | Class and Description |
|---|---|
static interface |
ImnuMap.DefaultValue<V> |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
ImnuMap()
Creates a new ImnuMap instance that returns null for all missing keys.
|
ImnuMap(ImnuMap.DefaultValue<V> defaultValue) |
| Modifier and Type | Method and Description |
|---|---|
V |
get(Object key) |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesequals, hashCode, toStringCopyright © 2012–2018 Emory University. All rights reserved.