public class MultiCollection<K,V>
extends java.lang.Object
implements java.util.Map<K,java.util.Collection<V>>, java.io.Serializable, java.lang.Cloneable
| Modifier and Type | Field and Description | 
|---|---|
protected java.util.Map<K,java.util.Collection<V>> | 
map
The map. 
 | 
protected java.lang.Class<?> | 
type
The collection type. 
 | 
| Constructor and Description | 
|---|
MultiCollection()
Create a new multi collection. 
 | 
MultiCollection(java.util.Map<K,java.util.Collection<V>> map,
               java.lang.Class<?> type)
Create a new multi collection. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
java.util.Collection<V> | 
add(K key,
   java.util.Collection<V> value)
Associates the specified value with the specified key in this map
 (optional operation). 
 | 
java.util.Collection<V> | 
add(K key,
   V value)
Associates the specified value with the specified key in this map
 (optional operation). 
 | 
void | 
addAll(java.util.Map<? extends K,? extends V> t)
Add all elements of another map. 
 | 
void | 
clear()
Removes all mappings from this map. 
 | 
java.lang.Object | 
clone()
Clone a multi collection. 
 | 
boolean | 
containsKey(java.lang.Object key)
Returns 
  | 
boolean | 
containsValue(java.lang.Object value)
Returns 
  | 
java.util.Collection<V> | 
createCollection(K key)
Create a collection instance. 
 | 
java.util.Set<java.util.Map.Entry<K,java.util.Collection<V>>> | 
entrySet()
Returns a set view of the mappings contained in this map. 
 | 
boolean | 
equals(java.lang.Object o)
Compares the specified object with this map for equality. 
 | 
java.util.Collection<V> | 
get(java.lang.Object key)
Returns the collection to which this map maps the specified key. 
 | 
java.util.Collection<V> | 
getCollection(java.lang.Object key)
Get the values associated to a key as collection. 
 | 
java.lang.Object[] | 
getKeys()
Get the keys as array. 
 | 
java.lang.Object[] | 
getKeys(java.lang.Class<?> type)
Get the keys as array. 
 | 
V | 
getObject(java.lang.Object key)
Get first object for a key (unwraps from collection). 
 | 
java.lang.Object[] | 
getObjects()
Get the values as array. 
 | 
java.lang.Object[] | 
getObjects(java.lang.Class<?> type)
Get the values as array. 
 | 
int | 
hashCode()
Returns the hash code value for this map. 
 | 
boolean | 
isEmpty()
Returns 
  | 
java.util.Set<K> | 
keySet()
Returns a set view of the keys contained in this map. 
 | 
java.util.Collection<V> | 
put(K key,
   java.util.Collection<V> value)
Associates the specified value with the specified key in this map
 (optional operation). 
 | 
void | 
putAll(java.util.Map<? extends K,? extends java.util.Collection<V>> t)
Copies all of the mappings from the specified map to this map
 (optional operation). 
 | 
java.util.Collection<V> | 
remove(java.lang.Object key)
Removes the mapping for this key from this map if it is present. 
 | 
void | 
removeObject(java.lang.Object key,
            java.lang.Object value)
Remove a special object from the 
  collection of a defined key. 
 | 
int | 
size()
Returns the number of elements added to this map. 
 | 
java.lang.String | 
toString()
Create a string representation of this map. 
 | 
java.util.Collection<java.util.Collection<V>> | 
values()
Unsupported Operation. 
 | 
public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic int size()
public boolean isEmpty()
public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,java.util.Collection<V>>key - key whose presence in this map is to be tested.java.lang.ClassCastException - if the key is of an inappropriate type for
                  this map (optional).java.lang.NullPointerException - if the key is 
public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,java.util.Collection<V>>value - value whose presence in this map is to be tested.java.lang.ClassCastException - if the value is of an inappropriate type for
                  this map (optional).java.lang.NullPointerException - if the value is 
public java.util.Collection<V> get(java.lang.Object key)
get in interface java.util.Map<K,java.util.Collection<V>>key - key whose associated collection is to be returned.java.lang.ClassCastException - if the key is of an inappropriate type for
                  this map (optional).java.lang.NullPointerException - key is 
containsKey(Object)public V getObject(java.lang.Object key)
key - The key.public java.util.Collection<V> put(K key, java.util.Collection<V> value)
m.containsKey(k) would return
 
put in interface java.util.Map<K,java.util.Collection<V>>key - key with which the specified value is to be associated.value - value to be associated with the specified key.java.lang.UnsupportedOperationException - if the 
java.lang.ClassCastException - if the class of the specified key or value
                  prevents it from being stored in this map.java.lang.IllegalArgumentException - if some aspect of this key or value
                  prevents it from being stored in this map.java.lang.NullPointerException - this map does not permit 
public java.util.Collection<V> add(K key, V value)
m.containsKey(k) would return
 
key - key with which the specified value is to be associated.value - value to be associated with the specified key.java.lang.UnsupportedOperationException - if the 
java.lang.ClassCastException - if the class of the specified key or value
                  prevents it from being stored in this map.java.lang.IllegalArgumentException - if some aspect of this key or value
                  prevents it from being stored in this map.java.lang.NullPointerException - this map does not permit 
public java.util.Collection<V> add(K key, java.util.Collection<V> value)
m.containsKey(k) would return
 
key - key with which the specified value is to be associated.value - value to be associated with the specified key.java.lang.UnsupportedOperationException - if the 
java.lang.ClassCastException - if the class of the specified key or value
                  prevents it from being stored in this map.java.lang.IllegalArgumentException - if some aspect of this key or value
                  prevents it from being stored in this map.java.lang.NullPointerException - this map does not permit 
public void addAll(java.util.Map<? extends K,? extends V> t)
t - The other map.public void putAll(java.util.Map<? extends K,? extends java.util.Collection<V>> t)
put(k, v) on this map once
 for each mapping from key 
putAll in interface java.util.Map<K,java.util.Collection<V>>t - Mappings to be stored in this map.java.lang.UnsupportedOperationException - if the 
java.lang.ClassCastException - if the class of a key or value in the
                  specified map prevents it from being stored in this map.java.lang.IllegalArgumentException - some aspect of a key or value in the
                  specified map prevents it from being stored in this map.java.lang.NullPointerException - the specified map is 
public void clear()
public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,java.util.Collection<V>>public java.util.Collection<java.util.Collection<V>> values()
public java.util.Set<java.util.Map.Entry<K,java.util.Collection<V>>> entrySet()
entrySet in interface java.util.Map<K,java.util.Collection<V>>public boolean equals(java.lang.Object o)
equals in interface java.util.Map<K,java.util.Collection<V>>equals in class java.lang.Objecto - object to be compared for equality with this map.public int hashCode()
hashCode in interface java.util.Map<K,java.util.Collection<V>>hashCode in class java.lang.ObjectObject.hashCode(), 
Object.equals(Object), 
equals(Object)public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Collection<V> remove(java.lang.Object key)
remove in interface java.util.Map<K,java.util.Collection<V>>key - key whose mapping is to be removed from the map.java.lang.ClassCastException - if the key is of an inappropriate type for
                  this map (optional).java.lang.NullPointerException - if the key is 
public java.util.Collection<V> getCollection(java.lang.Object key)
key - The key.public java.lang.Object[] getObjects()
public java.lang.Object[] getObjects(java.lang.Class<?> type)
type - The component type of the array.public java.lang.Object[] getKeys()
public java.lang.Object[] getKeys(java.lang.Class<?> type)
type - The component type of the array.public void removeObject(java.lang.Object key,
                         java.lang.Object value)