public class OneToManyHashBiMap<K,V> extends Object implements Map<K,Set<V>>, OneToManyBiMap<K,V>
Constructor and Description |
---|
OneToManyHashBiMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsSingleValue(V value)
This method returns
true if any of the value sets in the
OneToManyMap contains an equivalent object to the value
parameter, where equivalence is determined using the
equals(Object) method. |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entries()
This method is similar to the
java.util.Map.entrySet()
method, however the entries returned map from a key to a value, rather
than from a key(K ) to a value(V ) rather than
froma key(K ) to a set of values(Set<V> ). |
Set<Map.Entry<K,Set<V>>> |
entrySet() |
Collection<V> |
flatValues()
Returns a Collection of all the values in the map.
|
Set<V> |
get(Object key) |
K |
getKey(V value)
Returns the key, if any, for the specified
value . |
boolean |
isEmpty() |
Set<K> |
keySet() |
Set<V> |
put(K key,
Set<V> values) |
void |
putAll(Map<? extends K,? extends Set<V>> m) |
void |
putAllSingleValues(Map<? extends K,? extends V> m)
This method is similar to
java.utilMap.putAll(Map m) ,
however the map specified is from keys to values instead of keys to sets
of values. |
V |
putSingleValue(K key,
V value)
This method is similar to the method
java.util.Map.put(K, V)
, however it allows the user to add a single value to the map rather than
adding a java.util.Set containing one or more values. |
Set<V> |
remove(Object key) |
K |
removeValue(V value)
Removes the specified
value from the OneToManyBiMap . |
int |
size() |
Collection<Set<V>> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public boolean containsKey(Object key)
containsKey
in interface Map<K,Set<V>>
public boolean containsValue(Object value)
containsValue
in interface Map<K,Set<V>>
public boolean containsSingleValue(V value)
OneToManyMap
true
if any of the value sets in the
OneToManyMap contains an equivalent object to the value
parameter, where equivalence is determined using the
equals(Object)
method.containsSingleValue
in interface OneToManyMap<K,V>
value
- The value being searched for.true
if any of the value sets contains a
matching value, otherwise returns false
public Set<Map.Entry<K,V>> entries()
OneToManyMap
java.util.Map.entrySet()
method, however the entries returned map from a key to a value, rather
than from a key(K
) to a value(V
) rather than
froma key(K
) to a set of values(Set<V>
). java.util.Map.Entry.setValue(V)
.entries
in interface OneToManyMap<K,V>
Set<Entry<K, V>> representing all the key-value pairs in the ManyToOneMap.
public K getKey(V value)
OneToManyBiMap
value
. If the
specified value does not exist within the map then this method returns
null
.getKey
in interface OneToManyBiMap<K,V>
value
or null
.public V putSingleValue(K key, V value)
OneToManyMap
java.util.Map.put(K, V)
, however it allows the user to add a single value to the map rather than
adding a java.util.Set
containing one or more values. If the
specified key already has a set of values associated with it then the new
value is added to this set. Otherwise a new set is created and the new
value is added to that.putSingleValue
in interface OneToManyMap<K,V>
public void putAllSingleValues(Map<? extends K,? extends V> m)
OneToManyMap
java.utilMap.putAll(Map m)
,
however the map specified is from keys to values instead of keys to sets
of values.putAllSingleValues
in interface OneToManyMap<K,V>
m
- A map containing the key-value mappings to be added to the
ManyToOneMap.public K removeValue(V value)
OneToManyBiMap
value
from the OneToManyBiMap
. If this was the only value associated with the key to this value, then the key is also removed.removeValue
in interface OneToManyBiMap<K,V>
value
- The value to be removed.public Collection<V> flatValues()
OneToManyMap
values()
the values are in a single flattened
Collection<V>
rather than a
Collection<Set<V>>
.flatValues
in interface OneToManyMap<K,V>
Copyright © 2005–2018 Alfresco Software. All rights reserved.