|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.collections.EnumMap<E,V>
public class EnumMap<E extends Enum<E>,V>
Implementation of the Set
interface whose keys are backed by a set
of enum values.
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 | |
---|---|
EnumMap(Class<E> enumClass)
|
Method Summary | |
---|---|
void |
clear()
Removes all entries in the map. |
boolean |
containsKey(E key)
Tests the existence of a key in the dictionary. |
V |
get(E key)
Retrieves the value for the given key. |
Comparator<E> |
getComparator()
Returns the collection's sort order. |
int |
getCount()
Returns the number of entries in the map. |
ListenerList<MapListener<E,V>> |
getMapListeners()
Returns the map listener collection. |
boolean |
isEmpty()
Tests the emptiness of the collection. |
Iterator<E> |
iterator()
|
V |
put(E 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(E key)
Removes a key/value pair from the map. |
void |
setComparator(Comparator<E> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnumMap(Class<E> enumClass)
Method Detail |
---|
public V get(E key)
Dictionary
get
in interface Dictionary<E extends Enum<E>,V>
key
- The key whose value is to be returned.
public V put(E key, V value)
Map
put
in interface Dictionary<E extends Enum<E>,V>
put
in interface Map<E extends Enum<E>,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(E key)
Dictionary
remove
in interface Dictionary<E extends Enum<E>,V>
remove
in interface Map<E extends Enum<E>,V>
key
- The key whose mapping is to be removed.
MapListener.valueRemoved(Map, Object, Object)
public void clear()
Map
clear
in interface Collection<E extends Enum<E>>
clear
in interface Map<E extends Enum<E>,V>
MapListener.mapCleared(Map)
public boolean containsKey(E key)
Dictionary
containsKey
in interface Dictionary<E extends Enum<E>,V>
key
- The key whose presence in the dictionary is to be tested.
public boolean isEmpty()
Collection
isEmpty
in interface Collection<E extends Enum<E>>
public int getCount()
Map
getCount
in interface Map<E extends Enum<E>,V>
public Comparator<E> getComparator()
Collection
getComparator
in interface Collection<E extends Enum<E>>
Collection.setComparator(Comparator)
public void setComparator(Comparator<E> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<E extends Enum<E>>
setComparator
in interface Map<E extends Enum<E>,V>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.MapListener.comparatorChanged(Map, Comparator)
public Iterator<E> iterator()
iterator
in interface Iterable<E extends Enum<E>>
public ListenerList<MapListener<E,V>> getMapListeners()
Map
getMapListeners
in interface Map<E extends Enum<E>,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |