K
- V
- This class implements a cuckoo hashmap for storing objects
implementing the Keyableutil.java.HashMap
or other that can use up to hundreds of
bytes of additional overhead).
It supports two ways of iterating over the values in the map. The
first is a more traditional iterator. The second is a
non-fail-fast iterator that allows iteration as well as
remove
concurrently with other put/remove operations. The
iteration may miss concurrently added elements (but will not
return concurrently removed elements any time after they have been
removed. This non-fail-fast iterator is useful for doing an
"approximate" sweep over the entire map.
public class MultiArrayMap<K,V extends Keyable<K>>
extends java.lang.Object
implements java.lang.Iterable<V>, java.util.concurrent.ConcurrentMap<K,V>
Constructor and Description |
---|
MultiArrayMap(int size) |
MultiArrayMap(int size,
int levels) |
Modifier and Type | Method and Description |
---|---|
int |
capacity() |
void |
clear()
Resets the map.
|
java.util.Iterator<V> |
concurrentIterator() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
int |
hashmapSize() |
boolean |
isEmpty() |
java.util.Iterator<V> |
iterator() |
java.util.Set<K> |
keySet() |
static void |
main(java.lang.String[] args) |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
putIfAbsent(K key,
V value) |
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
int |
size() |
java.util.Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public MultiArrayMap(int size, int levels)
size
- levels
- public MultiArrayMap(int size)
size
- public int capacity()
public V get(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public V remove(java.lang.Object key)
public int size()
public int hashmapSize()
public void clear()
public boolean isEmpty()
public java.util.Set<K> keySet()
public java.util.Collection<V> values()
public boolean remove(java.lang.Object key, java.lang.Object value)
public java.util.Iterator<V> iterator()
public java.util.Iterator<V> concurrentIterator()
public static void main(java.lang.String[] args)
args
-