Package org.apache.pivot.collections
Interface Map<K,V>
-
- All Superinterfaces:
Collection<K>
,Dictionary<K,V>
,java.lang.Iterable<K>
- All Known Implementing Classes:
BeanAdapter
,CategorySeries
,EnumMap
,HashMap
,ImmutableMap
,MapAdapter
,SynchronizedMap
public interface Map<K,V> extends Dictionary<K,V>, Collection<K>
Collection interface representing set of key/value pairs.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary
Dictionary.Pair<K,V>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Removes all entries in the map.int
getCount()
Returns the number of entries in the map.ListenerList<MapListener<K,V>>
getMapListeners()
Returns the map listener collection.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(java.util.Comparator<K> 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 interface org.apache.pivot.collections.Collection
getComparator, isEmpty
-
Methods inherited from interface org.apache.pivot.collections.Dictionary
containsAny, containsKey, copy, get, getBoolean, getBoolean, getColor, getFirst, getFont, getInt, getInt, getString, getString, putAll
-
-
-
-
Method Detail
-
put
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.- Specified by:
put
in interfaceDictionary<K,V>
- Parameters:
key
- The key whose value is to be set.value
- The value to be associated with the given key.- Returns:
- The value previously associated with the key.
- See Also:
MapListener.valueAdded(Map, Object)
,MapListener.valueUpdated(Map, Object, Object)
-
remove
V remove(K key)
Description copied from interface:Dictionary
Removes a key/value pair from the map.- Specified by:
remove
in interfaceDictionary<K,V>
- Parameters:
key
- The key whose mapping is to be removed.- Returns:
- The value that was removed.
- See Also:
MapListener.valueRemoved(Map, Object, Object)
-
clear
void clear()
Removes all entries in the map.- Specified by:
clear
in interfaceCollection<K>
- See Also:
MapListener.mapCleared(Map)
-
getCount
int getCount()
Returns the number of entries in the map.- Returns:
- Current number of map entries.
-
setComparator
void setComparator(java.util.Comparator<K> comparator)
Description copied from interface:Collection
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.Calling this method more than once with the same comparator will re-sort the collection.
- Specified by:
setComparator
in interfaceCollection<K>
- Parameters:
comparator
- The comparator used to order elements in the collection, or null if the collection is unsorted.- See Also:
MapListener.comparatorChanged(Map, Comparator)
-
getMapListeners
ListenerList<MapListener<K,V>> getMapListeners()
Returns the map listener collection.- Returns:
- Current list of listeners on this map.
-
-