K
- the type of the keyV
- the type of the valuepublic interface MVMap<K,V>
extends java.lang.Iterable<V>
Map
but, unlike this, it
allows to map multiple values for the same key
. This value are stored
in a List
associated whit the key
. You can have duplicate
values associated with the same key.Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all element from the MVMap
|
boolean |
containsKey(K key)
Returns
true if the MVMap contain at least one value for the
specified key. |
boolean |
containsValue(V value)
Returns
true if the MVMap contains the specified value for any
key. |
boolean |
equals(java.lang.Object object) |
java.util.List<V> |
get(K key)
Returns a
List that contain the value mapped at specified key. |
int |
getKeysNumber()
Return a number of keys collected into MVMap
|
int |
hashCode() |
boolean |
isEmpty()
Returns
true if this map contains no key-value mappings. |
java.util.Iterator<V> |
iterator() |
boolean |
put(K key,
V value)
Associates the specified
value with the specified key in
this MVMap. |
boolean |
put(java.util.Map.Entry<K,V> e)
Is the same of the
put(Object key, Object value) but the
key-value pair is provided by a Map.Entry object. |
boolean |
remove(K key,
V value)
Removes the first occurrence of the specified element from this MVMap.
|
boolean |
remove(java.util.Map.Entry<K,V> e)
Removes the first occurrence of the specified element from this MVMap.
|
int |
size()
Returns the number of value contains in this Multi-Value Map.
|
V[] |
toArray(V[] v) |
java.lang.String |
toString() |
java.util.List<V> |
values()
Return a list of all values contained into MVMap
WARNING: the returned list should be used in read-only mode because it is
not synchronized with the rest of the map
|
void clear()
boolean containsKey(K key)
true
if the MVMap contain at least one value for the
specified key.key
- - key to searchtrue
- if the MVMap contain at least one value for the
specified keyboolean containsValue(V value)
true
if the MVMap contains the specified value for any
key.value
- - value to searchtrue
- if the MVMap contains the specified value for any
keyboolean equals(java.lang.Object object)
equals
in class java.lang.Object
java.util.List<V> get(K key)
List
that contain the value mapped at specified key. If
the key does not contain values (or not existing) it return an empty List
Changes to the List
are allowed and they are reflected on the
MVMap and vice versa.key
- - key to searchList<V>
whit the value mapped at specified key if any or
return an empty listint getKeysNumber()
int hashCode()
hashCode
in class java.lang.Object
boolean isEmpty()
true
if this map contains no key-value mappings.true
if this map contains no key-value mappingsboolean put(K key, V value)
value
with the specified key
in
this MVMap. Multiple value for each key
are allowed.key
- - the keyvalue
- - the valuetrue
if the value
are correctly added at the
MVMap. This depend of the specific implementation of List that is
used.boolean put(java.util.Map.Entry<K,V> e)
put(Object key, Object value)
but the
key-value pair is provided by a Map.Entry
object.e
- the key-value pairtrue
if the value
are correctly added at the
BucketMap. This depend of the specific implementation of List
that is used.boolean remove(K key, V value)
key
- the keyvalue
- the valueboolean remove(java.util.Map.Entry<K,V> e)
e
- the entry of the mapint size()
Integer.MAX_VALUE
and each key
can contain Integer.MAX_VALUE
value.V[] toArray(V[] v)
v
- the array type to be used for array constructionjava.lang.String toString()
toString
in class java.lang.Object
java.util.List<V> values()
Return a list of all values contained into MVMap
WARNING: the returned list should be used in read-only mode because it is not synchronized with the rest of the map