public final class HashedMapIntValue<K> extends Object
HashedMap
, but hardcodes Value type as primitive Ints, since generics don't support primitives (not without auto-boxing, which
generates garbage for the GC).
See HashedMap.java for additional comments throughout the code, since the classes are so similiar.
See HashedMapIntKey.java for the prime example of mapping HashedMap to primitive types.
One prime difference with HashedMap, is that this class maps Null keys to a special local object and then treats them normally, rather
than doing the complicated dance HashedMap does with multiple state variables.
Beware that this class is single-threaded and non-reentrant. Also note that this class's iterators are not fail-fast, unlike HashedMap.
Constructor and Description |
---|
HashedMapIntValue() |
HashedMapIntValue(int initcap) |
HashedMapIntValue(int initcap,
float factor) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(int val) |
int |
get(Object key) |
boolean |
isEmpty() |
Iterator<K> |
keysIterator() |
int |
put(K key,
int value) |
Iterator<K> |
recycledKeysIterator() |
IteratorInt |
recycledValuesIterator() |
int |
remove(Object key) |
int |
size() |
String |
toString() |
int |
trimToSize() |
IteratorInt |
valuesIterator() |
public HashedMapIntValue()
public HashedMapIntValue(int initcap)
public HashedMapIntValue(int initcap, float factor)
public boolean isEmpty()
public int size()
public void clear()
public boolean containsKey(Object key)
public int get(Object key)
public int put(K key, int value)
public int remove(Object key)
public boolean containsValue(int val)
public int trimToSize()
public IteratorInt valuesIterator()
public IteratorInt recycledValuesIterator()
Copyright 2010-2018 Grey Software (Yusef Badri). All Rights Reserved.