cern.colt.map.tint
Class QuickOpenIntIntHashMap
java.lang.Object
cern.colt.PersistentObject
cern.colt.map.tdouble.AbstractDoubleMap
cern.colt.map.tint.AbstractIntIntMap
cern.colt.map.tint.OpenIntIntHashMap
cern.colt.map.tint.QuickOpenIntIntHashMap
- All Implemented Interfaces:
- Serializable, 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
- Version:
- 1.0, 09/24/99
- Author:
- wolfgang.hoschek@cern.ch
- See Also:
HashMap
,
Serialized Form
Constructor Summary |
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 |
boolean |
put(int key,
int value)
Associates the given key with the given value. |
void |
rehash(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 |
totalProbesSaved
public int totalProbesSaved
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:
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:
IllegalArgumentException
- if
initialCapacity < 0 || (minLoadFactor < 0.0 || minLoadFactor >= 1.0) || (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor >= maxLoadFactor)
.
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:
put
in class OpenIntIntHashMap
- 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.
Jump to the Parallel Colt Homepage