|
||||||||||
| 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.SingleValueMap<K,V>
public class SingleValueMap<K,V>
The SingleValueMap is pretty much the same as a Map, but
it implements the MultiValueMap interface, e.g. to use normal maps in
a join (see JoinedMultiValueMap).
This class does not copy the values of the original java map, but encapsulates the java map.
| Constructor Summary | |
|---|---|
SingleValueMap(Map<K,V> map)
|
|
| Method Summary | |
|---|---|
Map<K,V> |
asSingleValueMap()
Implementation returns the underlying map. |
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 |
boolean |
equals(Object obj)
|
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 |
int |
hashCode()
|
MultiValueMap<V,K> |
invert()
Implementation returns a SingleValueMap instance if the mapping
from values to keys is unambiguous, and a DefaultMultiValueMap if
this is not the case. |
boolean |
isEmpty()
Returns true if this map is empty |
Set<K> |
keySet()
Returns a set containing all keys. |
int |
keySize()
Returns the number of keys contained in this mapping |
String |
toString()
|
Iterable<V> |
values()
Returns an unmodifiable iterator for all values |
int |
valueSize()
Returns the number of values contained in this mapping |
| Methods inherited from class ch.javasoft.util.map.AbstractMultiValueMap |
|---|
add, addAll, addAll, addAll, addAll, addAllNested, asCollectionMap, clear, remove, remove |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SingleValueMap(Map<K,V> map)
| Method Detail |
|---|
public 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 int count(Object key)
MultiValueMap
count in interface MultiValueMap<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 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()
MultiValueMap
keySet in interface MultiValueMap<K,V>public Map<K,V> asSingleValueMap()
Changing the returned map also affects this single value map.
asSingleValueMap in interface MultiValueMap<K,V>asSingleValueMap in class AbstractMultiValueMap<K,V>MultiValueMap.asSingleValueMap()public MultiValueMap<V,K> invert()
SingleValueMap instance if the mapping
from values to keys is unambiguous, and a DefaultMultiValueMap if
this is not the case.
Changing the returned map does not affect this single value map.
invert in interface MultiValueMap<K,V>invert in class AbstractMultiValueMap<K,V>AbstractMultiValueMap.invert()public boolean isEmpty()
MultiValueMap
isEmpty in interface MultiValueMap<K,V>isEmpty in class AbstractMultiValueMap<K,V>public int keySize()
MultiValueMap
keySize in interface MultiValueMap<K,V>keySize in class AbstractMultiValueMap<K,V>public int valueSize()
MultiValueMap
valueSize in interface MultiValueMap<K,V>valueSize in class AbstractMultiValueMap<K,V>public Iterable<V> values()
AbstractMultiValueMap
values in interface MultiValueMap<K,V>values in class AbstractMultiValueMap<K,V>MultiValueMap.values()public boolean equals(Object obj)
equals in class AbstractMultiValueMap<K,V>public int hashCode()
hashCode in class AbstractMultiValueMap<K,V>public String toString()
toString in class AbstractMultiValueMap<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||