cern.colt.map.tint
Class QuickOpenIntIntHashMap
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.colt.map.AbstractMap
-
- cern.colt.map.tint.AbstractIntIntMap
-
- cern.colt.map.tint.OpenIntIntHashMap
-
- cern.colt.map.tint.QuickOpenIntIntHashMap
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class QuickOpenIntIntHashMap extends OpenIntIntHashMap
Status: Experimental; Do not use for production yet. Hash map holding (key,value) associations of type (int-->int); Automatically grows and shrinks as needed; Implemented using open addressing with double hashing. First see the package summary and javadoc tree view to get the broad picture. Implements open addressing with double hashing, using "Brent's variation". Brent's variation slows insertions a bit down (not much) but reduces probes (collisions) for successful searches, in particular for large load factors. (It does not improve unsuccessful searches.) See D. Knuth, Searching and Sorting, 3rd ed., p.533-545- See Also:
HashMap, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description inttotalProbesSaved
-
Constructor Summary
Constructors Constructor and Description QuickOpenIntIntHashMap()Constructs an empty map with default capacity and default load factors.QuickOpenIntIntHashMap(int initialCapacity)Constructs an empty map with the specified initial capacity and default load factors.QuickOpenIntIntHashMap(int initialCapacity, double minLoadFactor, double maxLoadFactor)Constructs an empty map with the specified initial capacity and the specified minimum and maximum load factor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanput(int key, int value)Associates the given key with the given value.voidrehash(int newCapacity)Rehashes the contents of the receiver into a new table with a smaller or larger capacity.-
Methods inherited from class cern.colt.map.tint.OpenIntIntHashMap
clear, clone, containsKey, containsValue, ensureCapacity, forEachKey, forEachPair, get, keyOf, keys, pairsMatching, removeKey, trimToSize, values
-
Methods inherited from class cern.colt.map.tint.AbstractIntIntMap
assign, assign, copy, equals, keys, keysSortedByValue, pairsSortedByKey, pairsSortedByValue, toString, toStringByValue, values
-
Methods inherited from class cern.colt.map.AbstractMap
isEmpty, size
-
-
-
-
Constructor Detail
-
QuickOpenIntIntHashMap
public QuickOpenIntIntHashMap()
Constructs an empty map with default capacity and default load factors.
-
QuickOpenIntIntHashMap
public QuickOpenIntIntHashMap(int initialCapacity)
Constructs an empty map with the specified initial capacity and default load factors.- Parameters:
initialCapacity- the initial capacity of the map.- Throws:
java.lang.IllegalArgumentException- if the initial capacity is less than zero.
-
QuickOpenIntIntHashMap
public QuickOpenIntIntHashMap(int initialCapacity, double minLoadFactor, double maxLoadFactor)Constructs an empty map with the specified initial capacity and the specified minimum and maximum load factor.- Parameters:
initialCapacity- the initial capacity.minLoadFactor- the minimum load factor.maxLoadFactor- the maximum load factor.- Throws:
java.lang.IllegalArgumentException- if initialCapacity < 0 || (minLoadFactor < 0.0 || minLoadFactor >= 1.0) || (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor >= maxLoadFactor) .
-
-
Method Detail
-
put
public boolean put(int key, int value)Associates the given key with the given value. Replaces any old (key,someOtherValue) association, if existing.- Overrides:
putin classOpenIntIntHashMap- Parameters:
key- the key the value shall be associated with.value- the value to be associated.- Returns:
- true if the receiver did not already contain such a key; false if the receiver did already contain such a key - the new value has now replaced the formerly associated value.
-
rehash
public void rehash(int newCapacity)
Rehashes the contents of the receiver into a new table with a smaller or larger capacity. This method is called automatically when the number of keys in the receiver exceeds the high water mark or falls below the low water mark.
-
-
DMelt 3.0 © DataMelt by jWork.ORG