org.semanticweb.elk.util.collections
Class ArrayHashMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.semanticweb.elk.util.collections.ArrayHashMap<K,V>
- Type Parameters:
K - the type of the keysV - the type of the values
- All Implemented Interfaces:
- Map<K,V>
- Direct Known Subclasses:
- AbstractHashMultimap
public class ArrayHashMap<K,V>
- extends AbstractMap<K,V>
- implements Map<K,V>
hash maps using array and linear probing for resolving hash collision see [1]
p.526. Reuses some code from the implementation of HashMap.
[1] Donald E. Knuth, The Art of Computer Programming, Volume 3, Sorting and
Searching, Second Edition
- Author:
- Yevgeny Kazakov
|
Field Summary |
protected K[] |
keys
The table for the keys; the length MUST always be a power of two. |
protected int |
size
The number of key-value entries contained in this map. |
protected V[] |
values
The table for the values; the length MUST be equal to the length of keys
and MUST always be a power of two. |
keys
protected transient volatile K[] keys
- The table for the keys; the length MUST always be a power of two.
values
protected transient volatile V[] values
- The table for the values; the length MUST be equal to the length of keys
and MUST always be a power of two.
size
protected transient int size
- The number of key-value entries contained in this map.
ArrayHashMap
public ArrayHashMap(int initialCapacity)
ArrayHashMap
public ArrayHashMap()
size
public int size()
- Specified by:
size in interface Map<K,V>- Overrides:
size in class AbstractMap<K,V>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Map<K,V>- Overrides:
isEmpty in class AbstractMap<K,V>
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey in interface Map<K,V>- Overrides:
containsKey in class AbstractMap<K,V>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue in interface Map<K,V>- Overrides:
containsValue in class AbstractMap<K,V>
get
public V get(Object key)
- Specified by:
get in interface Map<K,V>- Overrides:
get in class AbstractMap<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>- Overrides:
put in class AbstractMap<K,V>
remove
public V remove(Object key)
- Specified by:
remove in interface Map<K,V>- Overrides:
remove in class AbstractMap<K,V>
clear
public void clear()
- Specified by:
clear in interface Map<K,V>- Overrides:
clear in class AbstractMap<K,V>
keySet
public Set<K> keySet()
- Specified by:
keySet in interface Map<K,V>- Overrides:
keySet in class AbstractMap<K,V>
values
public Collection<V> values()
- Specified by:
values in interface Map<K,V>- Overrides:
values in class AbstractMap<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface Map<K,V>- Specified by:
entrySet in class AbstractMap<K,V>
Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.