org.jvnet.hk2.component
Class MultiMap<K,V>

java.lang.Object
  extended by org.jvnet.hk2.component.MultiMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, MultiMap<K,V>

Deprecated.

@Deprecated
public class MultiMap<K,V>
extends Object
implements MultiMap<K,V>, Serializable, Cloneable

Map from a key to multiple values. Order is significant among values, and null values are allowed, although null keys are not.

Author:
Kohsuke Kawaguchi, Jerome Dochez
See Also:
Serialized Form

Constructor Summary
  MultiMap()
          Deprecated. Creates an empty multi-map with default concurrency controls
protected MultiMap(Map<K,List<V>> store, boolean concurrencyControls)
          Deprecated. Creates a multi-map backed by the given store.
  MultiMap(MultiMap<K,V> base)
          Deprecated. Copy constructor.
 
Method Summary
 void add(K k, V v)
          Deprecated. Adds one more key-value pair.
 MultiMap<K,V> clone()
          Deprecated. Creates a copy of the map that contains the exact same key and value set.
 boolean contains(K k1, V k2)
          Deprecated. Checks if the map contains the given key(s), also extending the search to including the sub collection.
 boolean containsKey(K k)
          Deprecated. Checks if the map contains the given key.
static
<K,V> MultiMap<K,V>
emptyMap()
          Deprecated. Gets the singleton read-only empty multi-map.
 Set<Map.Entry<K,List<V>>> entrySet()
          Deprecated. Lists up all entries.
 boolean equals(Object another)
          Deprecated.  
 List<V> get(K k)
          Deprecated. Returns the elements indexed by the provided key
 V getFirst(K k)
          Deprecated. Gets the first value if any, or null.
 List<V> getIntersectionOfAll(Collection<K> keys)
          Deprecated. Returns the intersection of all elements indexed by the provided keys.
 V getOne(K k)
          Deprecated. Gets the first value if any, or null.
 List<V> getUnionOfAll(Collection<K> keys)
          Deprecated. Returns the union of all elements indexed by the provided keys.
 int hashCode()
          Deprecated.  
 Set<K> keySet()
          Deprecated. Returns the keys of type K.
 void mergeAll(MultiMap<K,V> another)
          Deprecated.  
protected  List<V> newList(Collection<? extends V> initialVals)
          Deprecated. Creates an optionally populated list to be used as an entry in the map.
 List<V> remove(K key)
          Deprecated. Removes an key value from the map
 boolean remove(K key, V entry)
          Deprecated. Removes an key value pair from the map
 void set(K k, Collection<? extends V> v)
          Deprecated. Replaces all the existing values associated with the key by the given value.
 void set(K k, V v)
          Deprecated. Replaces all the existing values associated with the key by the given single value.
 int size()
          Deprecated. Returns the size of the map
 String toCommaSeparatedString()
          Deprecated.  
 String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiMap

public MultiMap()
Deprecated. 
Creates an empty multi-map with default concurrency controls


MultiMap

protected MultiMap(Map<K,List<V>> store,
                   boolean concurrencyControls)
Deprecated. 
Creates a multi-map backed by the given store.

Parameters:
store - map to copy

MultiMap

public MultiMap(MultiMap<K,V> base)
Deprecated. 
Copy constructor.

Parameters:
base - map to copy
Method Detail

hashCode

public int hashCode()
Deprecated. 
Overrides:
hashCode in class Object

equals

public boolean equals(Object another)
Deprecated. 
Overrides:
equals in class Object

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

newList

protected List<V> newList(Collection<? extends V> initialVals)
Deprecated. 
Creates an optionally populated list to be used as an entry in the map.

Parameters:
initialVal -
Returns:

keySet

public Set<K> keySet()
Deprecated. 
Description copied from interface: MultiMap
Returns the keys of type K.

Specified by:
keySet in interface MultiMap<K,V>
Returns:
Can be empty but never null. Read-only.

add

public final void add(K k,
                      V v)
Deprecated. 
Adds one more key-value pair.

Parameters:
k - key to store the entry under
v - value to store in the k's values.

set

public void set(K k,
                Collection<? extends V> v)
Deprecated. 
Replaces all the existing values associated with the key by the given value.

Parameters:
k - key for the values
v - Can be null or empty.

set

public void set(K k,
                V v)
Deprecated. 
Replaces all the existing values associated with the key by the given single value.

Parameters:
k - key for the values
v - singleton value for k key

This is short for set(k,Collections.singleton(v))


get

public final List<V> get(K k)
Deprecated. 
Returns the elements indexed by the provided key

Specified by:
get in interface MultiMap<K,V>
Parameters:
k - key for the values
Returns:
Can be empty but never null. Read-only.

getUnionOfAll

public List<V> getUnionOfAll(Collection<K> keys)
Deprecated. 
Returns the union of all elements indexed by the provided keys. This is a disjunctive operation.

Parameters:
keys - the collection of keys
Returns:
the union collection of values

getIntersectionOfAll

public List<V> getIntersectionOfAll(Collection<K> keys)
Deprecated. 
Returns the intersection of all elements indexed by the provided keys. That means that all values must appear for each and every key specified. This is a conjunctive operation.

Parameters:
keys - the collection of keys
Returns:
the intersecting collection of values

mergeAll

public void mergeAll(MultiMap<K,V> another)
Deprecated. 

containsKey

public boolean containsKey(K k)
Deprecated. 
Checks if the map contains the given key.

Specified by:
containsKey in interface MultiMap<K,V>
Parameters:
k - key to test
Returns:
true if the map contains at least one element for this key

contains

public boolean contains(K k1,
                        V k2)
Deprecated. 
Checks if the map contains the given key(s), also extending the search to including the sub collection.

Specified by:
contains in interface MultiMap<K,V>
Parameters:
k1 - key from top collection
k2 - key (value) from inner collection
Returns:
true if the map contains at least one element for these keys

remove

public List<V> remove(K key)
Deprecated. 
Removes an key value from the map

Parameters:
key - key to be removed
Returns:
the value stored under this key or null if there was none

remove

public boolean remove(K key,
                      V entry)
Deprecated. 
Removes an key value pair from the map

Parameters:
key - key to be removed
entry - the entry to be removed from the key'ed list
Returns:
true if there was none that was deleted

getOne

public V getOne(K k)
Deprecated. 
Gets the first value if any, or null.

This is useful when you know the given key only has one value and you'd like to get to that value.

Parameters:
k - key for the values
Returns:
null if the key has no values or it has a value but the value is null.

getFirst

public V getFirst(K k)
Deprecated. 
Description copied from interface: MultiMap
Gets the first value if any, or null.

This is useful when you know the given key only has one value and you'd like to get to that value.

Specified by:
getFirst in interface MultiMap<K,V>
Parameters:
k - key for the values
Returns:
null if the key has no values or it has a value but the value is null.

entrySet

public Set<Map.Entry<K,List<V>>> entrySet()
Deprecated. 
Lists up all entries.

Specified by:
entrySet in interface MultiMap<K,V>
Returns:
a Set of Map.Entry of entries

toCommaSeparatedString

public String toCommaSeparatedString()
Deprecated. 
Returns:
the map as "key=value1,key=value2,...."

clone

public MultiMap<K,V> clone()
Deprecated. 
Creates a copy of the map that contains the exact same key and value set. Keys and values won't cloned.

Overrides:
clone in class Object

size

public int size()
Deprecated. 
Returns the size of the map

Specified by:
size in interface MultiMap<K,V>
Returns:
integer or 0 if the map is empty

emptyMap

public static <K,V> MultiMap<K,V> emptyMap()
Deprecated. 
Gets the singleton read-only empty multi-map.

Returns:
an empty map
See Also:
Collections.emptyMap()


Copyright © 2013 Oracle Corporation. All Rights Reserved.