Package org.jboss.as.naming.util
Class FastCopyHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.jboss.as.naming.util.FastCopyHashMap<K,V>
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
public class FastCopyHashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable
A HashMap that is optimized for fast shallow copies. If the copy-ctor is passed another FastCopyHashMap, or clone is called on this map, the shallow copy can be performed using little more than a single array copy. In order to accomplish this, immutable objects must be used internally, so update operations result in slightly more object churn thanHashMap. Note: It is very important to use a smaller load factor than you normally would for HashMap, since the implementation is open-addressed with linear probing. With a 50% load-factor a get is expected to return in only 2 probes. However, a 90% load-factor is expected to return in around 50 probes.- Author:
- Jason T. Greene
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFastCopyHashMap.SimpleEntry<K,V>-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description FastCopyHashMap()FastCopyHashMap(int initialCapacity)FastCopyHashMap(int initialCapacity, float loadFactor)FastCopyHashMap(Map<? extends K,? extends V> map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()FastCopyHashMap<K,V>clone()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()Vget(Object key)booleanisEmpty()Set<K>keySet()voidprintDebugStats()Vput(K key, V value)voidputAll(Map<? extends K,? extends V> map)Vremove(Object key)intsize()Collection<V>values()-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>- Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>- Overrides:
containsValuein classAbstractMap<K,V>
-
clear
public void clear()
-
clone
public FastCopyHashMap<K,V> clone()
- Overrides:
clonein classAbstractMap<K,V>
-
printDebugStats
public void printDebugStats()
-
values
public Collection<V> values()
-
-