net.sf.molae.pipe.basic
Class AbstractMapWithSet<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
net.sf.molae.pipe.basic.AbstractMapWithSet<K,V>
- All Implemented Interfaces:
- Map<K,V>
- Direct Known Subclasses:
- EntryTransformedMap, KeyFilteredMap, ListAsMap, ListsBackedMap, MapTree
public abstract class AbstractMapWithSet<K,V>
- extends AbstractMap<K,V>
Enhancement of AbstractMap
that contains an
AbstractSet
to implement the entrySet
.
A map that is implemented by inheriting from AbstractMap
has to
implement entrySet()
.
AbstractMapWithSet provides a standard implementation for the entrySet
based on AbstractSet
.
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, toString, values |
AbstractMapWithSet
public AbstractMapWithSet()
getEntrySetIterator
protected abstract Iterator<Map.Entry<K,V>> getEntrySetIterator()
- Returns the iterator of the entry set.
- Returns:
- the iterator of the entry set.
size
public int size()
- Returns the number of mappings in this map.
This implementation uses the iterator to count the elements.
- Specified by:
size
in interface Map<K,V>
- Overrides:
size
in class AbstractMap<K,V>
- Returns:
- the number of mappings in this map.
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Returns a set view of the mappings contained in this map.
This implementation returns an instance of the inner class
AbstractMapWithSet.EntrySet
.
- Specified by:
entrySet
in interface Map<K,V>
- Specified by:
entrySet
in class AbstractMap<K,V>
- Returns:
- a set view of the mappings contained in this map.
keySet
public Set<K> keySet()
- Returns a set view of the keys contained in this map.
This implementation returns a
typesafe
version of the key set
from AbstractMap
- Specified by:
keySet
in interface Map<K,V>
- Overrides:
keySet
in class AbstractMap<K,V>
- Returns:
- a set view of the keys contained in this map.