SortedMap Interface
Home ] Up ] Map Interface ] HashMap Class ] [ SortedMap Interface ] TreeMap Class ] TreeMap with Comparator ]

 

 

The SortedMap interface is a sub-interface of Map

SortedMap is a map that further guarantees that it will be held in ascending key order, sorted according to the natural ordering of its keys (see the Comparable interface), or by a comparator provided at sorted map creation time.

SortedMap adds the following methods to those specified by Map:

Method Description
comparator() Returns the comparator associated with this sorted map, or null if it uses its keys' natural ordering.
subMap(fromKey, toKey) Returns a view of the portion of this sorted map whose keys range from fromKey, inclusive, to toKey, exclusive.
headMap(toKey) Returns a view of the portion of this sorted map whose keys are strictly less than toKey.
tailMap(fromKey) Returns a view of the portion of this sorted map whose keys are greater than or equal to fromKey.
firstKey() Returns the first (lowest) key currently in this sorted map.
lastKey() Returns the last (highest) key currently in this sorted map.
 

This page was last modified on 02 October, 2007