net.sf.molae.pipe.keyed
Class KeyedSetAsMap<K,V extends Keyed<K>>
java.lang.Object
java.util.AbstractMap<K,V>
net.sf.molae.pipe.keyed.KeyedSetAsMap<K,V>
- All Implemented Interfaces:
- Map<K,V>
public final class KeyedSetAsMap<K,V extends Keyed<K>>
- extends AbstractMap<K,V>
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.
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
KeyedSetAsMap
public KeyedSetAsMap(Collection<V> 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
.
asEntry
public static <K,V extends Keyed<K>> Map.Entry<K,V> asEntry(V base)
- Creates a map entry wrapper around a keyed object.
- Parameters:
base
- underlying keyed object
- Returns:
- the new map entry
size
public int size()
- Specified by:
size
in interface Map<K,V extends Keyed<K>>
- Overrides:
size
in class AbstractMap<K,V extends Keyed<K>>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interface Map<K,V extends Keyed<K>>
- Overrides:
containsValue
in class AbstractMap<K,V extends Keyed<K>>
put
public V put(K key,
V value)
- Specified by:
put
in interface Map<K,V extends Keyed<K>>
- Overrides:
put
in class AbstractMap<K,V extends Keyed<K>>
- Throws:
ClassCastException
- value is not a Keyed
object
or the base set does not allow the class of the specified object
IllegalArgumentException
- The specified key is not the key
of the specified value or the base set does not allow the
specified value
NullPointerException
- if value
is null
UnsupportedOperationException
- if the base set does not allow
new values
clear
public void clear()
- Removes all mappings from the base set.
- Specified by:
clear
in interface Map<K,V extends Keyed<K>>
- Overrides:
clear
in class AbstractMap<K,V extends Keyed<K>>
- Throws:
UnsupportedOperationException
- depending on the base set
values
public Collection<V> values()
- Specified by:
values
in interface Map<K,V extends Keyed<K>>
- Overrides:
values
in class AbstractMap<K,V extends Keyed<K>>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet
in interface Map<K,V extends Keyed<K>>
- Specified by:
entrySet
in class AbstractMap<K,V extends Keyed<K>>