|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpl.edu.agh.cast.util.MultiMap<K,V>
public class MultiMap<K,V>
This class implements a multi-map functionality. Multi-map is a map which
allows for multiple values to be kept under one key.
This implementation (by default) uses HashMap with LinkedLists,
however different Map implementation may be provided during
construction.
WARNING: This collection does not implement Collection interface and
is not in the Java Collections hierarchy.
| Constructor Summary | |
|---|---|
MultiMap()
Creates new instance using HashMap as underlying map. |
|
MultiMap(boolean allowDuplicates)
Creates new instance using HashMap as underlying map. |
|
MultiMap(java.util.Map<K,java.util.List<V>> map)
Creates new instance using map as underlying map. |
|
MultiMap(java.util.Map<K,java.util.List<V>> map,
boolean allowDuplicates)
Creates new instance using map as underlying map. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object obj)
|
java.util.List<V> |
get(K key)
Returns a (modifiable) list of values stored under given key. |
java.util.Map<K,java.util.List<V>> |
getMap()
Returns an unmodifiable view of the underlying map. |
boolean |
isAllowDuplicates()
Checks if duplicate values are allowed for one key. |
java.util.List<V> |
put(K key,
V... values)
Adds values to the key entry. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiMap()
HashMap as underlying map. No
duplicate values for single key are allowed.
public MultiMap(boolean allowDuplicates)
HashMap as underlying map. Duplicate
values for single key are allowed if allowDuplicates is
true.
allowDuplicates - if true than duplicate values are allowed for one
key. Defaults to falsepublic MultiMap(java.util.Map<K,java.util.List<V>> map)
map as underlying map. No
duplicate values for single key are allowed.
map - the underlying map
public MultiMap(java.util.Map<K,java.util.List<V>> map,
boolean allowDuplicates)
map as underlying map. Duplicate
values for single key are allowed if allowDuplicates is
true.
map - the underlying mapallowDuplicates - if true than duplicate values are allowed for one
key. Defaults to false| Method Detail |
|---|
public java.util.Map<K,java.util.List<V>> getMap()
public java.util.List<V> put(K key,
V... values)
values to the key entry. Behavior may
differ depending on the isAllowDuplicates() value.
key - the keyvalues - the values to add
public java.util.List<V> get(K key)
key - the key
public boolean isAllowDuplicates()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||