MetaDone
|
Public Member Functions | |
boolean | containsKey (Object key) |
boolean | contains (Object key, Object value) |
Set< V > | get (final Object key) |
boolean | put (K key, V val) |
void | putAll (K key, Collection<?extends V > values) |
void | putAll (Map<?extends K,?extends V > m) |
void | putAll (MultHashMap<?extends K,?extends V > m) |
boolean | remove (Object key, Object val) |
boolean | remove (Object key) |
void | clear () |
Set< K > | keySet () |
Iterator< Map.Entry< K, V > > | iterator () |
String | toString () |
Private Attributes | |
final Map< K, Set< V > > | store = new HashMap<K, Set<V>>() |
Implements a one-to-many store.
The implementation uses a hash map which values are sets. The sets are internally implemented by LinkedHashSet to keep track of the order in which values were added for a given key.
void metadone.util.MultHashMap< K, V >.clear | ( | ) |
Clears the elements.
boolean metadone.util.MultHashMap< K, V >.contains | ( | Object | key, |
Object | value | ||
) |
Tests if a pair is contained in this map.
key | The key |
value | The value |
true
if a pair (key,value) is present in this map boolean metadone.util.MultHashMap< K, V >.containsKey | ( | Object | key | ) |
Tests if a key has mappings in this multimap.
key | The key to test |
true
if the key is defined in the store Set<V> metadone.util.MultHashMap< K, V >.get | ( | final Object | key | ) |
Returns the set of elements linked to a key.
The resulting set is never null
, elements can be removed but no element can be added.
key | The key |
Iterator<Map.Entry<K, V> > metadone.util.MultHashMap< K, V >.iterator | ( | ) |
Set<K> metadone.util.MultHashMap< K, V >.keySet | ( | ) |
Gets the key set.
boolean metadone.util.MultHashMap< K, V >.put | ( | K | key, |
V | val | ||
) |
Adds a pair (key, val).
key | The key |
val | The value |
true
if the pair was added void metadone.util.MultHashMap< K, V >.putAll | ( | MultHashMap<?extends K,?extends V > | m | ) |
Puts all the entries in this map.
m | The other map |
void metadone.util.MultHashMap< K, V >.putAll | ( | Map<?extends K,?extends V > | m | ) |
Puts all the entries in this map.
m | The other map |
void metadone.util.MultHashMap< K, V >.putAll | ( | K | key, |
Collection<?extends V > | values | ||
) |
Puts all the pairs (key, value) in the map.
key | The key |
values | The values |
boolean metadone.util.MultHashMap< K, V >.remove | ( | Object | key | ) |
Removes all the pairs (key,*).
this.contains(key)==false
key | The key |
true
if values were removed boolean metadone.util.MultHashMap< K, V >.remove | ( | Object | key, |
Object | val | ||
) |
Removes a pair (key,val) from the store.
key | The key |
val | The value |
true
if the pair was removed String metadone.util.MultHashMap< K, V >.toString | ( | ) |
final Map<K, Set<V> > metadone.util.MultHashMap< K, V >.store = new HashMap<K, Set<V>>() [private] |