
Parameters: toKey - high endpoint (exclusive) of the keys in the returned map Returns: a view of the portion of this map whose keys are strictly On an attempt to insert a key outside its range. Optional map operations that this map supports. The returned map is backedīy this map, so changes in the returned map are reflected in Returns a view of the portion of this map whose keys are ToKey or if this map itself has a restricted

Is null and this map does not permit null keys IllegalArgumentException - if fromKey is greater than NullPointerException - if fromKey or toKey Implementations may, but are not required to, throw thisĬannot be compared to keys currently in the map. (or, if the map has no comparator, using natural ordering). Parameters: fromKey - low endpoint (inclusive) of the keys in the returned map toKey - high endpoint (exclusive) of the keys in the returned map Returns: a view of the portion of this map whose keys range fromįromKey, inclusive, to toKey, exclusive Throws: ClassCastException - if fromKey and toKeyĬannot be compared to one another using this map's comparator The returned map will throw an IllegalArgumentException

The returned map supports all optional map operations that this In the returned map are reflected in this map, and vice-versa. Is empty.) The returned map is backed by this map, so changes (IfįromKey and toKey are equal, the returned map Returns a view of the portion of this map whose keys range fromįromKey, inclusive, to toKey, exclusive. SortedMap sub = m.subMap(low+"\0", high) View containing all of the key-value mappings in m whose keys SortedMap sub = m.subMap(low, high+"\0") Ī similar technique can be used to generate an open range The following idiom obtains a viewĬontaining all of the key-value mappings in m whose keys are If you need aĬlosed range (which includes both endpoints), and the key typeĪllows for calculation of the successor of a given key, merely request Such ranges are half-open, that is, they include their lowĮndpoint but not their high endpoint (where applicable). Note: several methods return submaps with restricted key

(This interface is the map analogue of SortedSet.)Īll keys inserted into a sorted map must implement the Comparable Several additional operations are provided to take advantage of the Iterating over the sorted map's collection views (returned by the Ordering of its keys, or by a Comparator typically The map is ordered according to the natural A Map that further provides a total ordering on its keys.
