|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
net.ontopia.utils.CompactHashMap<K,V>
public class CompactHashMap<K,V>
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected static java.lang.Object |
deletedObject
When a key is deleted this object is put into the hashtable in its place, so that other entries with the same key (collisions) further down the hashtable are not lost after we delete an object in the collision chain. |
protected int |
elements
|
protected int |
freecells
|
protected static int |
INITIAL_SIZE
|
protected K[] |
keys
|
protected static double |
LOAD_FACTOR
|
protected int |
modCount
|
protected static java.lang.Object |
nullObject
This object is used to represent null, should clients use that as a key. |
protected V[] |
values
|
| Constructor Summary | |
|---|---|
CompactHashMap()
Constructs a new, empty set. |
|
CompactHashMap(int size)
Constructs a new, empty set. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all key/value mappings in the map. |
boolean |
containsKey(java.lang.Object k)
Returns true if this map contains the specified key. |
boolean |
containsValue(java.lang.Object v)
Returns true if this map contains the specified value. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a read-only set view of the map's keys. |
V |
get(java.lang.Object k)
Returns the value for the key k, if there is one, and null if there is none. |
boolean |
isEmpty()
Returns true if this map contains no mappings. |
java.util.Set<K> |
keySet()
Returns a virtual read-only set of all the keys in the map. |
V |
put(K k,
V v)
Adds the specified mapping to this map, returning the old value for the mapping, if there was one. |
protected void |
rehash(int newCapacity)
INTERNAL: Rehashes the hashmap to a bigger size. |
V |
remove(java.lang.Object k)
Removes the mapping with key k, if there is one, and returns its value, if there is one, and null if there is none. |
int |
size()
Returns the number of key/value mappings in this map. |
java.util.Collection<V> |
values()
Returns a virtual read-only collection containing all the values in the map. |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, hashCode, putAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int INITIAL_SIZE
protected static final double LOAD_FACTOR
protected static final java.lang.Object nullObject
protected static final java.lang.Object deletedObject
protected int elements
protected int freecells
protected K[] keys
protected V[] values
protected int modCount
| Constructor Detail |
|---|
public CompactHashMap()
public CompactHashMap(int size)
| Method Detail |
|---|
public int size()
size in interface java.util.Map<K,V>size in class java.util.AbstractMap<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>isEmpty in class java.util.AbstractMap<K,V>public void clear()
clear in interface java.util.Map<K,V>clear in class java.util.AbstractMap<K,V>public boolean containsKey(java.lang.Object k)
containsKey in interface java.util.Map<K,V>containsKey in class java.util.AbstractMap<K,V>public boolean containsValue(java.lang.Object v)
containsValue in interface java.util.Map<K,V>containsValue in class java.util.AbstractMap<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>entrySet in class java.util.AbstractMap<K,V>public V remove(java.lang.Object k)
remove in interface java.util.Map<K,V>remove in class java.util.AbstractMap<K,V>
public V put(K k,
V v)
put in interface java.util.Map<K,V>put in class java.util.AbstractMap<K,V>protected void rehash(int newCapacity)
public V get(java.lang.Object k)
get in interface java.util.Map<K,V>get in class java.util.AbstractMap<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>values in class java.util.AbstractMap<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>keySet in class java.util.AbstractMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||