/* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package jsr166x; import java.util.*; import java.util.concurrent.*; /** * A {@link ConcurrentMap} supporting {@link NavigableMap} operations. * * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ public interface ConcurrentNavigableMap extends ConcurrentMap, NavigableMap { /** * Returns a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. (If * fromKey and toKey are equal, the returned sorted map * is empty.) The returned sorted map is backed by this map, so changes * in the returned sorted map are reflected in this map, and vice-versa. * * @param fromKey low endpoint (inclusive) of the subMap. * @param toKey high endpoint (exclusive) of the subMap. * * @return a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. * * @throws ClassCastException if fromKey and * toKey cannot be compared to one another using this * map's comparator (or, if the map has no comparator, using * natural ordering). * @throws IllegalArgumentException if fromKey is greater * than toKey. * @throws NullPointerException if fromKey or * toKey is null and this map does not support * null keys. */ public ConcurrentNavigableMap subMap(K fromKey, K toKey); /** * Returns a view of the portion of this map whose keys are strictly less * than toKey. The returned sorted map is backed by this map, so * changes in the returned sorted map are reflected in this map, and * vice-versa. * @param toKey high endpoint (exclusive) of the headMap. * @return a view of the portion of this map whose keys are strictly * less than toKey. * * @throws ClassCastException if toKey is not compatible * with this map's comparator (or, if the map has no comparator, * if toKey does not implement Comparable). * @throws NullPointerException if toKey is null * and this map does not support null keys. */ public ConcurrentNavigableMap headMap(K toKey); /** * Returns a view of the portion of this map whose keys are * greater than or equal to fromKey. The returned sorted * map is backed by this map, so changes in the returned sorted * map are reflected in this map, and vice-versa. * @param fromKey low endpoint (inclusive) of the tailMap. * @return a view of the portion of this map whose keys are greater * than or equal to fromKey. * @throws ClassCastException if fromKey is not compatible * with this map's comparator (or, if the map has no comparator, * if fromKey does not implement Comparable). * @throws NullPointerException if fromKey is null * and this map does not support null keys. */ public ConcurrentNavigableMap tailMap(K fromKey); }