public class OpenHashMap<K,V> extends AbstractKeyBasedMap<K,V>
Map that is optimized for memory footprint. Specifically, instead of instantiating an "Entry" object for each element (as the HashMap does, which references those entries in a linked list fashion with the head of the linked list stored in the hash bucket array, this implementation stores its elements using an open hashing algorithm, i.e. the keys are stored directly in the hash bucket array and the values are stored in a corresponding values array.
This implementation is explicitly NOT thread-safe.
| Modifier and Type | Class and Description |
|---|---|
class |
OpenHashMap.EntrySet
A set of entries backed by this map.
|
protected class |
OpenHashMap.KeySet
A set of keys backed by this map.
|
AbstractKeyBasedMap.DeferredCacheEvent<K,V>, AbstractKeyBasedMap.ValuesCollectionBase.LoggingWriter, Base.StackFrame| Constructor and Description |
|---|
OpenHashMap()
Default constructor.
|
OpenHashMap(int initialCapacity)
Create a OpenHashMap pre-sized to hold the specified number of entries.
|
OpenHashMap(Map map)
Create a OpenHashMap that will initially contain the contents of the passed Map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all key/value mappings.
|
boolean |
containsKey(Object oKey)
Returns true if this map contains a mapping for the specified key.
|
V |
get(Object oKey)
Returns the value to which this map maps the specified key.
|
protected Set |
instantiateEntrySet()
Factory pattern: Create a Set that represents the entries in the Map.
|
protected Set |
instantiateKeySet()
Factory pattern: Create a Set that represents the keys in the Map
|
protected Iterator |
iterateKeys()
Create an iterator over the keys in this Map.
|
Object |
put(Object oKey, Object oValue)
Associates the specified value with the specified key in this map.
|
V |
remove(Object oKey)
Removes the mapping for this key from this map if present.
|
int |
size()
Returns the number of key-value mappings in this map.
|
clone, containsValue, entrySet, equals, getAll, hashCode, instantiateValues, isEmpty, keySet, putAll, removeBlind, toString, valuesazzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, waitfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic OpenHashMap()
public OpenHashMap(int initialCapacity)
initialCapacity - the initial capacity requirement for the hash mappublic OpenHashMap(Map map)
map - the Collection whose contents thispublic int size()
public boolean containsKey(Object oKey)
containsKey in interface Map<K,V>containsKey in class AbstractKeyBasedMap<K,V>public Object put(Object oKey, Object oValue)
put in interface Map<K,V>put in class AbstractKeyBasedMap<K,V>oKey - key with which the specified value is to be associatedoValue - value to be associated with the specified keypublic V remove(Object oKey)
remove in interface Map<K,V>remove in class AbstractKeyBasedMap<K,V>oKey - key whose mapping is to be removed from the mappublic void clear()
protected Set instantiateKeySet()
instantiateKeySet in class AbstractKeyBasedMap<K,V>protected Set instantiateEntrySet()
instantiateEntrySet in class AbstractKeyBasedMap<K,V>protected Iterator iterateKeys()
iterateKeys in class AbstractKeyBasedMap<K,V>