The Collection Framework provides a special Map interface for maintaining elements in a sorted order called SortedMap.
The interface provides access methods to the ends of the map as well to subsets of the set. Working with a SortedMap is just like a SortedSet, except the sort is done on the map keys. The implementation class provided by the Collection Framework is a TreeMap.
The interface provides access methods to the ends of the map as well to subsets of the set. Working with a SortedMap is just like a SortedSet, except the sort is done on the map keys. The implementation class provided by the Collection Framework is a TreeMap.
Comparator | comparator() Returns the comparator associated with this sorted map, or null if it uses its keys' natural ordering. |
Object | firstKey() Returns the first (lowest) key currently in this sorted map. |
SortedMap | headMap(Object toKey) Returns a view of the portion of this sorted map whose keys are strictly less than toKey. |
Object | lastKey() Returns the last (highest) key currently in this sorted map. |
SortedMap | subMap(Object fromKey, Object toKey) Returns a view of the portion of this sorted map whose keys range from fromKey, inclusive, to toKey, exclusive. |
SortedMap | tailMap(Object fromKey) Returns a view of the portion of this sorted map whose keys are greater than or equal to fromKey. |
0 comments
Post a Comment