|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.util.ListMultimap<K,V>
K
- the keyV
- the valuepublic class ListMultimap<K,V>
A multimap that uses List
objects to store its values. The internal
Map
implementation is a LinkedHashMap
that uses
ArrayList
for its values.
Constructor Summary | |
---|---|
ListMultimap()
Creates an empty multimap. |
|
ListMultimap(int initialCapacity)
Creates an empty multimap. |
|
ListMultimap(ListMultimap<K,V> orig)
Creates a copy of an existing multimap. |
Method Summary | |
---|---|
void |
clear()
Clears all entries from the multimap. |
boolean |
containsKey(K key)
Determines whether the given key exists. |
boolean |
equals(Object obj)
|
V |
first(K key)
Gets the first value that's associated with a key. |
List<V> |
get(K key)
Gets the values associated with the key. |
Map<K,List<V>> |
getMap()
Gets the underlying Map object. |
int |
hashCode()
|
boolean |
isEmpty()
Determines if the multimap is empty or not. |
Iterator<Map.Entry<K,List<V>>> |
iterator()
|
Set<K> |
keySet()
Returns all the keys. |
void |
put(K key,
V value)
Adds a value to the multimap. |
void |
putAll(K key,
Collection<V> values)
Adds multiple values to the multimap. |
boolean |
remove(K key,
V value)
Removes a particular value. |
List<V> |
removeAll(K key)
Removes all the values associated with a key |
List<V> |
replace(K key,
Collection<V> values)
Replaces all values with the given values. |
List<V> |
replace(K key,
V value)
Replaces all values with the given value. |
protected K |
sanitizeKey(K key)
Modifies a given key before it is used to interact with the internal map. |
int |
size()
Returns the number of values in the map. |
String |
toString()
|
List<V> |
values()
Returns all the values. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ListMultimap()
public ListMultimap(int initialCapacity)
initialCapacity
- the initial capacity of the underlying map.public ListMultimap(ListMultimap<K,V> orig)
orig
- the multimap to copy fromMethod Detail |
---|
public void put(K key, V value)
key
- the keyvalue
- the value to addpublic void putAll(K key, Collection<V> values)
key
- the keyvalues
- the values to addpublic List<V> get(K key)
key
- the key
public V first(K key)
key
- the key
public boolean containsKey(K key)
key
- the key
public boolean remove(K key, V value)
key
- the keyvalue
- the value to remove
public List<V> removeAll(K key)
key
- the key to remove
public List<V> replace(K key, V value)
key
- the keyvalue
- the value with which to replace all existing values, or null
to remove all values
public List<V> replace(K key, Collection<V> values)
key
- the keyvalues
- the values with which to replace all existing values
public void clear()
public Set<K> keySet()
public List<V> values()
public boolean isEmpty()
public int size()
public Map<K,List<V>> getMap()
Map
object.
Map
objectprotected K sanitizeKey(K key)
key
- the key
public Iterator<Map.Entry<K,List<V>>> iterator()
iterator
in interface Iterable<Map.Entry<K,List<V>>>
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |