MultiMap

public class MultiMap
extends Object implements Serializable

java.lang.Object
   ↳ com.android.tradefed.util.MultiMap<K, V>
Known Direct Subclasses
UniqueMultiMap<K, V> A MultiMap that ensures unique values for each key. 


A Map that supports multiple values per key.

Summary

Public constructors

MultiMap()

Public methods

void clear()

Clears the map.

boolean containsKey(K key)

Checks whether the map contains the specified key.

boolean containsValue(V value)

Checks whether the map contains the specified value.

boolean equals(Object obj)

List<V> get(K key)

Gets the list of values associated with each key.

Map<String, V> getUniqueMap()

Construct a new map, that contains a unique String key for each value.

int hashCode()

boolean isEmpty()
Set<K> keySet()

Check if map is empty.

V put(K key, V value)

Adds the value to the list associated with a key.

void putAll(Map<? extends K, ? extends V> m)

Adds all entries in given Map to this MultiMap.

void putAll(MultiMap<K, ? extends V> m)

Adds all entries in given MultiMap to this MultiMap.

List<V> remove(K key)

Removes all values associated with the specified key.

int size()

Returns the number of keys in the map

List<V> values()

Returns list of all values.

Public constructors

MultiMap

MultiMap ()

Public methods

clear

void clear ()

Clears the map.

containsKey

boolean containsKey (K key)

Checks whether the map contains the specified key.

Parameters
key K

Returns
boolean

containsValue

boolean containsValue (V value)

Checks whether the map contains the specified value.

Parameters
value V

Returns
boolean

equals

boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

get

List<V> get (K key)

Gets the list of values associated with each key.

Parameters
key K

Returns
List<V>

getUniqueMap

Map<String, V> getUniqueMap ()

Construct a new map, that contains a unique String key for each value. Current algorithm will construct unique key by appending a unique position number to key's toString() value

Returns
Map<String, V> a Map

hashCode

int hashCode ()

Returns
int

isEmpty

boolean isEmpty ()

Returns
boolean

See also:

keySet

Set<K> keySet ()

Check if map is empty.

Returns
Set<K>

put

V put (K key, 
                V value)

Adds the value to the list associated with a key.

Parameters
key K

value V

Returns
V

putAll

void putAll (Map<? extends K, ? extends V> m)

Adds all entries in given Map to this MultiMap.

Parameters
m Map

putAll

void putAll (MultiMap<K, ? extends V> m)

Adds all entries in given MultiMap to this MultiMap.

Parameters
m MultiMap

remove

List<V> remove (K key)

Removes all values associated with the specified key.

Parameters
key K

Returns
List<V>

size

int size ()

Returns the number of keys in the map

Returns
int

values

List<V> values ()

Returns list of all values.

Returns
List<V>