|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pivot.collections.adapter.MapAdapter<K,V>
public class MapAdapter<K,V>
Implementation of the Map interface that is backed by an instance of
Map.
| 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> |
| Constructor Summary | |
|---|---|
MapAdapter(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. |
V |
get(K key)
Retrieves the value for the given key. |
Comparator<K> |
getComparator()
Returns the collection's sort order. |
int |
getCount()
Returns the number of entries in the map. |
Map<K,V> |
getMap()
|
ListenerList<MapListener<K,V>> |
getMapListeners()
Returns the map listener collection. |
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MapAdapter(Map<K,V> map)
| Method Detail |
|---|
public Map<K,V> getMap()
public V get(K key)
Dictionary
get in interface Dictionary<K,V>key - The key whose value is to be returned.
public V put(K key,
V value)
Map
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.
MapListener.valueAdded(Map, Object),
MapListener.valueUpdated(Map, Object, Object)public V remove(K key)
Dictionary
remove in interface Dictionary<K,V>remove in interface Map<K,V>key - The key whose mapping is to be removed.
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)
Dictionary
containsKey in interface Dictionary<K,V>key - The key whose presence in the dictionary is to be tested.
public boolean isEmpty()
Collection
isEmpty in interface Collection<K>public int getCount()
Map
getCount in interface Map<K,V>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 String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||