public class OpenHashMap<K,V>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, java.util.SortedMap<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
OpenHashMap.AbstractObjectCollection<K> |
static class |
OpenHashMap.AbstractObjectSet<K> |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
containsNullKey |
protected V |
defRetValue |
protected java.util.SortedSet<java.util.Map.Entry<K,V>> |
entries |
protected float |
f |
protected java.lang.Iterable<java.util.Map.Entry<K,V>> |
fast |
protected int |
first |
protected java.lang.Object[] |
key |
protected java.util.SortedSet<K> |
keys |
protected int |
last |
protected long[] |
link |
protected int |
mask |
protected int |
maxFill |
protected int |
n |
protected int |
size |
protected java.lang.Object[] |
value |
protected java.util.Collection<V> |
values |
| Constructor and Description |
|---|
OpenHashMap() |
OpenHashMap(int expected) |
OpenHashMap(int expected,
float f) |
OpenHashMap(K[] k,
V[] v) |
OpenHashMap(K[] k,
V[] v,
float f) |
OpenHashMap(java.util.Map<? extends K,? extends V> m) |
OpenHashMap(java.util.Map<? extends K,? extends V> m,
float f) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
OpenHashMap<K,V> |
clone() |
java.util.Comparator<? super K> |
comparator() |
protected V |
compute(K k) |
boolean |
containsKey(java.lang.Object k) |
boolean |
containsValue(java.lang.Object v) |
V |
defaultReturnValue() |
void |
defaultReturnValue(V rv) |
java.util.SortedSet<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
java.lang.Iterable<java.util.Map.Entry<K,V>> |
fast() |
K |
firstKey() |
protected void |
fixPointers(int i) |
protected void |
fixPointers(int s,
int d) |
V |
get(java.lang.Object k) |
V |
getOrCompute(K k) |
int |
hashCode() |
java.util.SortedMap<K,V> |
headMap(K to) |
boolean |
isEmpty() |
java.util.SortedSet<K> |
keySet() |
K |
lastKey() |
V |
put(K k,
V v) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
protected void |
rehash(int newN)
Rehashes the map.
|
V |
remove(java.lang.Object k) |
V |
removeFirst() |
V |
removeLast() |
protected void |
shiftKeys(int pos) |
int |
size() |
java.util.SortedMap<K,V> |
subMap(K from,
K to) |
java.util.SortedMap<K,V> |
tailMap(K from) |
java.lang.String |
toString() |
boolean |
trim()
Rehashes the map, making the table as small as possible.
|
boolean |
trim(int n)
Rehashes this map if the table is too large.
|
java.util.Collection<V> |
values() |
protected transient java.lang.Object[] key
protected transient java.lang.Object[] value
protected transient int mask
protected transient boolean containsNullKey
protected transient int first
protected transient int last
protected transient long[] link
protected transient int n
protected transient int maxFill
protected int size
protected final float f
protected V defRetValue
protected transient java.util.SortedSet<K> keys
protected transient java.util.Collection<V> values
public OpenHashMap(int expected,
float f)
public OpenHashMap(int expected)
public OpenHashMap()
public void defaultReturnValue(V rv)
public V defaultReturnValue()
public boolean equals(java.lang.Object o)
public java.lang.String toString()
toString in class java.lang.Objectprotected final void shiftKeys(int pos)
public V removeFirst()
public V removeLast()
public boolean containsKey(java.lang.Object k)
public boolean containsValue(java.lang.Object v)
protected void fixPointers(int i)
protected void fixPointers(int s,
int d)
public java.util.Comparator<? super K> comparator()
public java.util.SortedSet<K> keySet()
public java.util.Collection<V> values()
public boolean trim()
This method rehashes the table to the smallest size satisfying the load factor. It can be used when the set will not be changed anymore, so to optimize access speed and size.
If the table size is already the minimum possible, this method does nothing.
trim(int)public boolean trim(int n)
Let N be the smallest table size that can hold
max(n, entries, still satisfying the load factor. If the current
table size is smaller than or equal to N, this method does
nothing. Otherwise, it rehashes this map in a table of size
N.
size())
This method is useful when reusing maps. Clearing a map leaves the table size untouched. If you are reusing a map many times, you can call this method with a typical size to avoid keeping around a very large table just because of a few large transient maps.
n - the threshold for the trimming.trim()protected void rehash(int newN)
This method implements the basic rehashing strategy, and may be overriden by subclasses implementing different rehashing strategies (e.g., disk-based rehashing). However, you should not override this method unless you understand the internal workings of this class.
newN - the new sizepublic OpenHashMap<K,V> clone()
clone in class java.lang.ObjectCopyright (c) aQute SARL (2000, 2019) and others. All Rights Reserved.