|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pivot.collections.HashMap<K,V>
public class HashMap<K,V>
Implementation of the Map interface that is backed by a
hash table.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.pivot.collections.Map |
|---|
Map.MapListenerList<K,V> |
| Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary |
|---|
Dictionary.Pair<K,V> |
| Field Summary | |
|---|---|
static int |
DEFAULT_CAPACITY
|
static float |
DEFAULT_LOAD_FACTOR
|
| Constructor Summary | |
|---|---|
HashMap()
|
|
HashMap(Comparator<K> comparator)
|
|
HashMap(Dictionary.Pair<K,V>... entries)
|
|
HashMap(int capacity)
|
|
HashMap(int capacity,
float loadFactor)
|
|
HashMap(Map<K,V> map)
|
|
| Method Summary | |
|---|---|
void |
clear()
Removes all entries in the map. |
boolean |
containsKey(K key)
Tests the existence of a key in the dictionary. |
boolean |
equals(Object o)
|
V |
get(K key)
Retrieves the value for the given key. |
int |
getCapacity()
|
Comparator<K> |
getComparator()
Returns the collection's sort order. |
int |
getCount()
Returns the number of entries in the map. |
ListenerList<MapListener<K,V>> |
getMapListeners()
Returns the map listener collection. |
int |
hashCode()
|
boolean |
isEmpty()
Tests the emptiness of the collection. |
Iterator<K> |
iterator()
|
V |
put(K key,
V value)
Sets the value of the given key, creating a new entry or replacing the existing value, and firing a corresponding event. |
V |
remove(K key)
Removes a key/value pair from the map. |
void |
setComparator(Comparator<K> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
| Constructor Detail |
|---|
public HashMap()
public HashMap(int capacity)
public HashMap(int capacity,
float loadFactor)
public HashMap(Dictionary.Pair<K,V>... entries)
public HashMap(Map<K,V> map)
public HashMap(Comparator<K> comparator)
| Method Detail |
|---|
public V get(K key)
get in interface Dictionary<K,V>key - The key whose value is to be returned.
IllegalArgumentException - If key is null.
public V put(K key,
V value)
put in interface Dictionary<K,V>put in interface Map<K,V>key - The key whose value is to be set.value - The value to be associated with the given key.
IllegalArgumentException - If key is null.MapListener.valueAdded(Map, Object),
MapListener.valueUpdated(Map, Object, Object)public V remove(K key)
remove in interface Dictionary<K,V>remove in interface Map<K,V>key - The key whose mapping is to be removed.
IllegalArgumentException - If key is null.MapListener.valueRemoved(Map, Object, Object)public void clear()
Map
clear in interface Collection<K>clear in interface Map<K,V>MapListener.mapCleared(Map)public boolean containsKey(K key)
containsKey in interface Dictionary<K,V>key - The key whose presence in the dictionary is to be tested.
IllegalArgumentException - If key is null.public boolean isEmpty()
Collection
isEmpty in interface Collection<K>public int getCount()
Map
getCount in interface Map<K,V>public int getCapacity()
public Comparator<K> getComparator()
Collection
getComparator in interface Collection<K>Collection.setComparator(Comparator)public void setComparator(Comparator<K> comparator)
CollectionCalling this method more than once with the same comparator will re-sort the collection.
setComparator in interface Collection<K>setComparator in interface Map<K,V>comparator - The comparator used to order elements in the collection, or null if the
collection is unsorted.MapListener.comparatorChanged(Map, Comparator)public Iterator<K> iterator()
iterator in interface Iterable<K>public ListenerList<MapListener<K,V>> getMapListeners()
Map
getMapListeners in interface Map<K,V>public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||