|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javimmutable.collections.common.AbstractJImmutableMap<K,V>
org.javimmutable.collections.hash.JImmutableHashMap<T,K,V>
@Immutable public class JImmutableHashMap<T,K,V>
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.javimmutable.collections.JImmutableMap |
---|
JImmutableMap.Entry<K,V> |
Method Summary | ||
---|---|---|
JImmutableMap<K,V> |
assign(K key,
V value)
Sets the value associated with a specific key. |
|
Cursor<JImmutableMap.Entry<K,V>> |
cursor()
|
|
JImmutableMap<K,V> |
delete(K key)
Deletes the entry for the specified key (if any). |
|
JImmutableMap<K,V> |
deleteAll()
|
|
Holder<V> |
find(K key)
Search for a value within the map and return a Holder indicating if the value was found and, if it was found, the value itself. |
|
Holder<JImmutableMap.Entry<K,V>> |
findEntry(K key)
Search for an Entry within the map and return a Holder indicating if the Entry was found and, if it was found, the Entry itself. |
|
static
|
forKey(K key)
Returns an empty map using the appropriate collision handling strategy for the given key's class. |
|
V |
getValueOr(K key,
V defaultValue)
Return the value associated with key or defaultValue if no value is associated. |
|
static
|
of()
Returns an empty hash map. |
|
static
|
of(Class<K> klass)
Returns an empty map using the appropriate collision handling strategy for keys of the given class. |
|
int |
size()
Return the number of entries in the map. |
|
static
|
usingList()
Returns an empty map using linked lists for handling hash code collisions. |
|
static
|
usingTree()
Returns an empty map using linked lists for handling hash code collisions. |
Methods inherited from class org.javimmutable.collections.common.AbstractJImmutableMap |
---|
equals, get, getMap, hashCode, insert, isEmpty, iterator, keysCursor, toString, valuesCursor |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static <K,V> EmptyHashMap<K,V> of()
K
- V
-
public static <K,V> JImmutableMap<K,V> of(Class<K> klass)
K
- V
- klass
-
public static <K,V> JImmutableMap<K,V> forKey(K key)
K
- V
- key
-
public static <K,V> JImmutableMap<K,V> usingList()
K
- V
-
public static <K extends Comparable<K>,V> JImmutableMap<K,V> usingTree()
K
- V
-
public V getValueOr(K key, V defaultValue)
Mapped
key
- identifies the value to retrievedefaultValue
- value to return if no entry exists for key
@Nonnull public Holder<V> find(@Nonnull K key)
JImmutableMap
key
- non-null key to search for
@Nonnull public Holder<JImmutableMap.Entry<K,V>> findEntry(@Nonnull K key)
JImmutableMap
key
- non-null key to search for
@Nonnull public JImmutableMap<K,V> assign(@Nonnull K key, V value)
JImmutableMap
key
- non-null keyvalue
- possibly null value
@Nonnull public JImmutableMap<K,V> delete(@Nonnull K key)
JImmutableMap
key
- non-null key
public int size()
JImmutableMap
@Nonnull public JImmutableMap<K,V> deleteAll()
@Nonnull public Cursor<JImmutableMap.Entry<K,V>> cursor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |