com.vividsolutions.jump.util
Class CollectionMap

java.lang.Object
  extended by com.vividsolutions.jump.util.CollectionMap
All Implemented Interfaces:
java.util.Map

public class CollectionMap
extends java.lang.Object
implements java.util.Map

A Map whose values are Collections.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
CollectionMap()
          Creates a CollectionMap.
CollectionMap(java.lang.Class mapClass)
          Creates a CollectionMap backed by the given Map class.
CollectionMap(java.lang.Class mapClass, java.lang.Class collectionClass)
           
 
Method Summary
 void addItem(java.lang.Object key, java.lang.Object item)
          Adds the item to the Collection at the given key, creating a new Collection if necessary.
 void addItems(CollectionMap other)
           
 void addItems(java.lang.Object key, java.util.Collection items)
          Adds the items to the Collection at the given key, creating a new Collection if necessary.
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
           
 java.util.Collection getItems(java.lang.Object key)
           
 java.util.Map getMap()
           
 boolean isEmpty()
           
 java.util.Set keySet()
          Returns the keys.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object key)
           
 void removeItem(java.lang.Object key, java.lang.Object item)
           
 void removeItems(java.lang.Object key, java.util.Collection items)
           
 int size()
          Returns the number of mappings.
 java.util.Collection values()
          Returns the values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

CollectionMap

public CollectionMap(java.lang.Class mapClass)
Creates a CollectionMap backed by the given Map class.

Parameters:
mapClass - a Class that implements Map

CollectionMap

public CollectionMap(java.lang.Class mapClass,
                     java.lang.Class collectionClass)

CollectionMap

public CollectionMap()
Creates a CollectionMap.

Method Detail

addItem

public void addItem(java.lang.Object key,
                    java.lang.Object item)
Adds the item to the Collection at the given key, creating a new Collection if necessary.

Parameters:
key - the key to the Collection to which the item should be added
item - the item to add

removeItem

public void removeItem(java.lang.Object key,
                       java.lang.Object item)

clear

public void clear()
Specified by:
clear in interface java.util.Map

addItems

public void addItems(java.lang.Object key,
                     java.util.Collection items)
Adds the items to the Collection at the given key, creating a new Collection if necessary.

Parameters:
key - the key to the Collection to which the items should be added
items - the items to add

addItems

public void addItems(CollectionMap other)

values

public java.util.Collection values()
Returns the values.

Specified by:
values in interface java.util.Map
Returns:
a view of the values, backed by this CollectionMap

keySet

public java.util.Set keySet()
Returns the keys.

Specified by:
keySet in interface java.util.Map
Returns:
a view of the keys, backed by this CollectionMap

size

public int size()
Returns the number of mappings.

Specified by:
size in interface java.util.Map
Returns:
the number of key-value pairs

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map

getItems

public java.util.Collection getItems(java.lang.Object key)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map

removeItems

public void removeItems(java.lang.Object key,
                        java.util.Collection items)

getMap

public java.util.Map getMap()