|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.util.map.AbstractMultiValueMap<K,V>
ch.javasoft.util.map.JoinedMultiValueMap<K,V>
K - the key type of the one side of the joinV - the value type of the many side of the joinpublic class JoinedMultiValueMap<K,V>
The JoinedMultiValueMap class joins two instances of
MultiValueMap. The resulting multi value map is immutable.
Joining multi value maps nests the joined maps and does not copy the values.
However, for a large number of accesses, it might be more efficient to
materialize the joined map using flatten() beforehand.
| Constructor Summary | |
|---|---|
JoinedMultiValueMap(MultiValueMap<K,?> one,
MultiValueMap<?,V> many)
Cconstructor to join two multi value maps |
|
| Method Summary | ||
|---|---|---|
boolean |
contains(Object key)
Returns true if the value collection is non-empty |
|
boolean |
contains(Object key,
V value)
Returns true if the value collection contains at least one occurrence of the given value |
|
int |
count(Object key)
Returns the number of values in the value collection |
|
protected Collection<V> |
createCollection(Collection<V> values)
Returns a new collection instance. |
|
MultiValueMap<K,V> |
flatten()
Materializes this virtual multi value map into a new instance of DefaultMultiValueMap, a mutable map, by copying the content of
this map into the new instance. |
|
Collection<V> |
get(Object key)
Returns a collection for all values belonging to the specified key, or an empty collection if no such key collection exists yet. |
|
V |
getFirst(Object key)
Returns the first value of the value collection, or null if no such value exists |
|
static
|
join(MultiValueMap<K,?> one,
MultiValueMap<?,V> many)
Alternative to the constructor, for convenience only. |
|
static
|
join(MultiValueMap<K,?> first,
MultiValueMap<?,V> last,
MultiValueMap<?,?>... intermediate)
Joins several multi value maps resulting in a new virtual multi value map. |
|
Set<K> |
keySet()
Returns an unmodifiable set with the keys |
|
Iterable<V> |
values()
Returns an unmodifiable iterator for all values |
|
| Methods inherited from class ch.javasoft.util.map.AbstractMultiValueMap |
|---|
add, addAll, addAll, addAll, addAll, addAllNested, asCollectionMap, asSingleValueMap, clear, equals, hashCode, invert, isEmpty, keySize, remove, remove, toString, valueSize |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JoinedMultiValueMap(MultiValueMap<K,?> one,
MultiValueMap<?,V> many)
one - the one side of the joinmany - the many side of the join| Method Detail |
|---|
public static <K,V> JoinedMultiValueMap<K,V> join(MultiValueMap<K,?> one,
MultiValueMap<?,V> many)
K - the key type of the one side of the joinV - the value type of the many side of the joinone - the one side of the joinmany - the many side of the join
public static <K,V> JoinedMultiValueMap<K,V> join(MultiValueMap<K,?> first,
MultiValueMap<?,V> last,
MultiValueMap<?,?>... intermediate)
K - the key type of the head map of the joinV - the value type of the tail map of the joinfirst - the head map of the joinlast - the tail map of the joinintermediate - intermediary maps of the join, in join order
public MultiValueMap<K,V> flatten()
DefaultMultiValueMap, a mutable map, by copying the content of
this map into the new instance.
DefaultMultiValueMap instance containing the same
key/collection-of-value pairs as this multi value mappublic boolean contains(Object key)
MultiValueMap
contains in interface MultiValueMap<K,V>contains in class AbstractMultiValueMap<K,V>key - the key which identifies the value collection
public boolean contains(Object key,
V value)
MultiValueMap
contains in interface MultiValueMap<K,V>key - the key which identifies the value collectionvalue - the value to look for
public int count(Object key)
MultiValueMap
count in interface MultiValueMap<K,V>key - the key which identifies the value collection
public Collection<V> get(Object key)
MultiValueMap
get in interface MultiValueMap<K,V>key - the key which identifies the value collection
public V getFirst(Object key)
MultiValueMap
getFirst in interface MultiValueMap<K,V>getFirst in class AbstractMultiValueMap<K,V>key - the key which identifies the value collection
public Set<K> keySet()
keySet in interface MultiValueMap<K,V>MultiValueMap.keySet()public Iterable<V> values()
AbstractMultiValueMap
values in interface MultiValueMap<K,V>values in class AbstractMultiValueMap<K,V>MultiValueMap.values()protected Collection<V> createCollection(Collection<V> values)
ArrayList with
the given values is created, or an empty
list if values is null.
values - the values to be added to the created list, or null if
an empty list should be returned
empty list if values is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||