public class CompactMap<K,V> extends Object implements Map<K,V>
Map.Entry
.
null
to be used
as a key in the map. The client may use NULL_KEY masking on its own side
if it wants to use null keys (see java.util.HashMap
impl).
1.0
but if the approximate map size
is known there is a constructor that allows to pass the initial capacity.
HashMap.hash()
.
Object.equals()
is used for comparison.
Modifier and Type | Class and Description |
---|---|
static class |
CompactMap.DefaultMapEntry<K,V>
Default implementation of the map entry similar to e.g.
|
static class |
CompactMap.MapEntry<K,V>
Abstract implementation of the map entry.
|
Constructor and Description |
---|
CompactMap() |
CompactMap(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
CompactMap.MapEntry<K,V> |
getFirstEntry(int hashCode)
Get an entry from a bucket that corresponds to the given hash code.
|
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
CompactMap.MapEntry<K,V> |
putEntry(CompactMap.MapEntry<K,V> entry)
Put the given entry into the map.
|
V |
remove(Object key) |
CompactMap.MapEntry<K,V> |
removeEntry(CompactMap.MapEntry<K,V> entry)
Remove the given entry from the map.
|
int |
size() |
String |
toString() |
Collection<V> |
values() |
public CompactMap.MapEntry<K,V> getFirstEntry(int hashCode)
hashCode
- computed hash code.public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public CompactMap.MapEntry<K,V> putEntry(CompactMap.MapEntry<K,V> entry)
public CompactMap.MapEntry<K,V> removeEntry(CompactMap.MapEntry<K,V> entry)