RFR : 7129185 : Add Collections.{checked|empty|unmodifiable}Navigable{Map|Set}

Mike Duigou mike.duigou at oracle.com
Tue Apr 30 01:54:19 UTC 2013

Hello all;

This is a non-integration code review. I am picking this patch up after ignoring it for most of the last year. I've recently expanded the regression tests to, I believe, handle almost all of the new code paths added by this patch.


This issue is a follow-on to JDK-4533691 which added emptySortedSet(). In addition to adding support for NavigableSet/Map this patch also corrects differences between the behaviour of:

Set<Integer> uts = Collections.unmodifiableNavigableSet(new TreeSet())


Set<Integer> es = Collections.emptyNavigableSet()

involving bounded sub-ranges. At this point I believe that "uts" and "es" will be operationally indistinguishable. emptyNavigableSet() will still be more efficient though as it is a singleton and doesn't generally(*) consume additional resources for each instance. The asterisk next to generally comes from the bounded sub-ranges functionality. Sub ranges of empty SortedSet and NavigableSet will no longer be the singleton. They are instead instances which capture the range.

Because so much time has passed since this issue originally surfaced I'm concerned that I might be forgetting something. I do know that I still need to create an EmptyNavigableMap unit test and add serialversionid to all the new classes but does anything else seem to be missing either in terms of the implementation or the tests?


More information about the core-libs-dev mailing list