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 than
HashMap.
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionFastCopyHashMap(int initialCapacity) FastCopyHashMap(int initialCapacity, float loadFactor) FastCopyHashMap(Map<? extends K, ? extends V> map) -
Method Summary
Methods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
FastCopyHashMap
public FastCopyHashMap(int initialCapacity, float loadFactor) -
FastCopyHashMap
-
FastCopyHashMap
public FastCopyHashMap(int initialCapacity) -
FastCopyHashMap
public FastCopyHashMap()
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
get
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V>
-
put
-
putAll
-
remove
-
clear
public void clear() -
clone
- Overrides:
clonein classAbstractMap<K,V>
-
printDebugStats
public void printDebugStats() -
entrySet
-
keySet
-
values
-