|
||||||||||
| 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 |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected static 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 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(Object k)
Returns true if this map contains the specified key. |
boolean |
containsValue(Object v)
Returns true if this map contains the specified value. |
Set<Map.Entry<K,V>> |
entrySet()
Returns a read-only set view of the map's keys. |
V |
get(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. |
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(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. |
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 Object nullObject
protected static final 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 Map<K,V>size in class AbstractMap<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>isEmpty in class AbstractMap<K,V>public void clear()
clear in interface Map<K,V>clear in class AbstractMap<K,V>public boolean containsKey(Object k)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>public boolean containsValue(Object v)
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in class AbstractMap<K,V>public V remove(Object k)
remove in interface Map<K,V>remove in class AbstractMap<K,V>
public V put(K k,
V v)
put in interface Map<K,V>put in class AbstractMap<K,V>protected void rehash(int newCapacity)
public V get(Object k)
get in interface Map<K,V>get in class AbstractMap<K,V>public Collection<V> values()
values in interface Map<K,V>values in class AbstractMap<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in class AbstractMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||