org.jboss.portal.common.util
Class CollectionMap<K,V>

java.lang.Object
  extended by org.jboss.portal.common.util.CollectionMap<K,V>
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ListMap, SetMap

public abstract class CollectionMap<K,V>
extends java.lang.Object
implements java.io.Serializable

A map of collections.

Version:
$Revision: 1.1 $
Author:
Julien Viet
See Also:
Serialized Form

Constructor Summary
CollectionMap()
           
CollectionMap(SetMap<K,V> other)
           
 
Method Summary
protected abstract  void add(java.util.Collection<V> c, V o)
           
 boolean contains(K key, java.lang.Object o)
          Return true if the specified set contains the object o.
 java.util.Collection<V> get(K key)
          Return the collection specified by the key.
 java.util.Iterator<V> iterator(K key)
          Return an iterator over the values in the set specified by the key.
 java.util.Set<K> keySet()
          Return the set of keys.
protected abstract  java.util.Collection<V> newCollection()
           
protected abstract  java.util.Collection<V> newCollection(java.util.Collection<V> other)
           
 void put(K key, V o)
          Add an object in the set keyed under the specified key.
protected abstract  void remove(java.util.Collection<V> c, java.lang.Object o)
          Removes an object from the collection.
 void remove(K key)
          Remove the entire set of objects specified by the key.
 void remove(K key, java.lang.Object o)
          Remove an object in the set keyed under the specified key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionMap

public CollectionMap()

CollectionMap

public CollectionMap(SetMap<K,V> other)
              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

put

public final void put(K key,
                      V o)
               throws java.lang.NullPointerException
Add an object in the set keyed under the specified key.

Throws:
java.lang.NullPointerException - if the key is null

keySet

public final java.util.Set<K> keySet()
Return the set of keys.


remove

public final void remove(K key)
                  throws java.lang.NullPointerException
Remove the entire set of objects specified by the key.

Throws:
java.lang.NullPointerException - if the key is null

remove

public final void remove(K key,
                         java.lang.Object o)
                  throws java.lang.NullPointerException
Remove an object in the set keyed under the specified key.

Throws:
java.lang.NullPointerException - if the key is null

contains

public final boolean contains(K key,
                              java.lang.Object o)
                       throws java.lang.NullPointerException
Return true if the specified set contains the object o.

Throws:
java.lang.NullPointerException - if the key is null

get

public java.util.Collection<V> get(K key)
Return the collection specified by the key.


iterator

public final java.util.Iterator<V> iterator(K key)
Return an iterator over the values in the set specified by the key.

Throws:
java.lang.NullPointerException - if the key is null

add

protected abstract void add(java.util.Collection<V> c,
                            V o)

remove

protected abstract void remove(java.util.Collection<V> c,
                               java.lang.Object o)
Removes an object from the collection. The type of the object to remove is intentionnally Object and not the parameterized type because the Collection interface is designed that way.

Parameters:
c - the collection to remove from
o - the object to remove

newCollection

protected abstract java.util.Collection<V> newCollection()

newCollection

protected abstract java.util.Collection<V> newCollection(java.util.Collection<V> other)