Package com.zybooks.dsaj.map
Class AbstractMap<K,V>
java.lang.Object
com.zybooks.dsaj.map.AbstractMap<K,V>
- Type Parameters:
K
- The key type (keys must be unique)V
- The value type
- All Implemented Interfaces:
Map<K,
V>
- Direct Known Subclasses:
AbstractHashMap
,AbstractSortedMap
,UnsortedTableMap
An abstract base class to ease the implementation of the Map interface.
The base class provides three means of support:
1) It defines a protected MapEntry class as a concrete implementation of the
entry interface
2) It provides an isEmpty implementation based upon the abstract size() method.
3) It provides implemenations of the keySet and values methods, based upon use
of a presumed implementation of the entrySet method.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A concrete implementation of the Entry interface to be used within a Map implementation. -
Constructor Summary
-
Method Summary
-
Constructor Details
-
AbstractMap
public AbstractMap()
-
-
Method Details
-
isEmpty
public boolean isEmpty()Tests whether the map is empty. -
keySet
Returns an iterable collection of the keys contained in the map. -
values
Returns an iterable collection of the values contained in the map. Note that the same value will be given multiple times in the result if it is associated with multiple keys.
-