EVALUATION
It is easy to get multiple entries *following* a given key, merely
by iterating over tailMap(k).entrySet(). It is more difficult to get
multiple keys preceding a given key. (You're stuck doing the
headMap(k).lastKey() trick repeatedly, which is ugly and not very
efficient.)
We initially did provide a List view of SortedMap (actually TreeMap), but
backed away from this as it required implementers to support "rank operations"
(i.e., positional access to SortedMap entries). This is a significant
burden for many Map implementations, including Red-Black trees. It would
be nice if we could provide iteration without providing positional access,
but the current interfaces don't make this easy.
I'll continue to think about this problem, in the hope that it can
be addressed prior to FCS.
joshua.bloch@Eng 1998-07-21
Bidirectional navigation will be addressed by the Navigable* interfaces,
the higher/lower/ceiling/floor methods,
the descending iterator methods,
implemented in TreeMap and TreeSet and the new ConcurrentSkipList* classes,
coming with the integration of JSR166x.
###@###.### 2005-05-10 02:34:56 GMT
|