net.sf.molae.pipe.keyed
Class KeyedSetAsMap
java.lang.Object
|
+--java.util.AbstractMap
|
+--net.sf.molae.pipe.keyed.KeyedSetAsMap
- All Implemented Interfaces:
- Map
- public final class KeyedSetAsMap
- extends AbstractMap
A set of Keyed objects represented as a map.
The performance of this map is not good, so it should be used
for transformtion only.
|
Constructor Summary |
KeyedSetAsMap(Collection base)
Creates a new map from the specified collection of keyed objects. |
KeyedSetAsMap
public KeyedSetAsMap(Collection base)
- Creates a new map from the specified collection of keyed objects.
- Parameters:
base - the underlying collection of keyed objects- Throws:
ClassCastException - if any element of the collection is
not a Keyed object.NullPointerException - if the specified collection is
null.
size
public int size()
- Overrides:
size in class AbstractMap
containsValue
public boolean containsValue(Object value)
- Overrides:
containsValue in class AbstractMap
put
public Object put(Object key,
Object value)
- Overrides:
put in class AbstractMap
- Throws:
ClassCastException - value is not a Keyed object
or the base set does not allow the class of the specified objectIllegalArgumentException - The specified key is not the key
of the specified value or the base set does not allow the
specified valueNullPointerException - if value is nullUnsupportedOperationException - if the base set does not allow
new values
clear
public void clear()
- Removes all mappings from the base set.
- Overrides:
clear in class AbstractMap
- Throws:
UnsupportedOperationException - depending on the base set
values
public Collection values()
- Overrides:
values in class AbstractMap
entrySet
public Set entrySet()
- Overrides:
entrySet in class AbstractMap