Hashtable that can contain several entries per key.
(Helper Class)
Contract:
entrySet is not supported. Instead, it can be iterated over all entries.
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
DEFAULT_HASHTABLE_SIZE
private static final int DEFAULT_HASHTABLE_SIZE
- See Also:
- Constant Field Values
DEFAULT_LIST_SIZE
private static final int DEFAULT_LIST_SIZE
- See Also:
- Constant Field Values
listSize
private int listSize
hashtable
HashMap<K,List<V>> hashtable
size
int size
ChainedHashMap
public ChainedHashMap()
ChainedHashMap
public ChainedHashMap(int hashtableSize)
ChainedHashMap
public ChainedHashMap(int hashtableSize,
int chainSize)
ChainedHashMap
public ChainedHashMap(Map<? extends K,? extends V> map)
size
public int size()
- Specified by:
size
in interface Map<K,V>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Map<K,V>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map<K,V>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interface Map<K,V>
get
public V get(Object key)
- Specified by:
get
in interface Map<K,V>
getIterable
public Iterable<V> getIterable(Object key)
- Get all objects linked by this key
as an Iterable usable an foreach loop.
- Parameters:
key
-
- Returns:
- Iterable
- Throws:
NullPointerException
- (if key null)
getList
public List<V> getList(Object key)
iterator
public Iterator<Map.Entry<K,V>> iterator()
- Iterate over all elements in the table.
Note that this currently copies them into a collection,
so concurrent modification will not be taken into account
(there will be no ConcurrentModificationException, either).
- Specified by:
iterator
in interface Iterable<Map.Entry<K,V>>
put
public V put(K key,
V value)
- Specified by:
put
in interface Map<K,V>
remove
public V remove(Object key)
- Specified by:
remove
in interface Map<K,V>
remove
public boolean remove(K key,
V value)
putAll
public void putAll(Map<? extends K,? extends V> map)
- Specified by:
putAll
in interface Map<K,V>
clear
public void clear()
- Specified by:
clear
in interface Map<K,V>
keySet
public Set<K> keySet()
- Specified by:
keySet
in interface Map<K,V>
values
public Collection<V> values()
- Specified by:
values
in interface Map<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet
in interface Map<K,V>
toString
public String toString()
- Overrides:
toString
in class Object
Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info