|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.slide.util.HashMap
My implementation of a JDK 1.2 Map. I do not use synchronization, so be careful in a threaded environment. I also do not specifically "implements" java.util.Map, since support for JDK 1.1 is needed.
Inner Class Summary | |
(package private) class |
HashMap.Bucket
The Entry bucket used by this Map implementation |
(package private) class |
HashMap.Entry
An object representing an entry in the Map table |
Field Summary | |
static int |
DEFAULT_SIZE
The default number of buckets in this Map |
Constructor Summary | |
HashMap()
Creates a new HashMap with the default number of buckets |
|
HashMap(int size)
Creates a new HashMap with the given number of buckets. |
Method Summary | |
void |
clear()
Removes all entries from this Map |
boolean |
containsKey(java.lang.Object key)
Returns true if the given object is a key contained in this Map |
boolean |
containsValue(java.lang.Object value)
Returns true if the given object is a value contained in this Map Note: Depending on the size of the Map, this could be a slow operation. |
Iterator |
entries()
Returns an interator for the entries of this Map. |
boolean |
equals(java.lang.Object object)
Returns true if the given Object is a HashMap which contains equivalent HashMap entries as this HashMap. |
java.lang.Object |
get(java.lang.Object key)
Returns the value associated with the given key |
int |
hashCode()
Returns the hashCode for this Map. |
boolean |
isEmpty()
Returns true if this map contains no entries |
Iterator |
keys()
|
void |
put(java.lang.Object key,
java.lang.Object value)
Associated the specified value with the given key in this Map |
java.lang.Object |
remove(java.lang.Object key)
Removes the association with the given Key in the Map. |
int |
size()
Returns the number of associations in the Map |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int DEFAULT_SIZE
Constructor Detail |
public HashMap()
public HashMap(int size)
size,
- the number of buckets to use, this value must
be a non-zero positive integer, if not the default size will
be used.
Method Detail |
public void clear()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public Iterator entries()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public java.lang.Object get(java.lang.Object key)
public int hashCode()
hashCode
in class java.lang.Object
public boolean isEmpty()
public Iterator keys()
public void put(java.lang.Object key, java.lang.Object value)
key
- the object to associate with the given valuevalue
- the object to add an association in this Mappublic java.lang.Object remove(java.lang.Object key)
key
- the object key to remove the association forpublic int size()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |