Code Review Request Bug #7129185:(coll) Please add Collections.emptyNavigableSet()
Jason Mehrens
jason_mehrens at hotmail.com
Tue Jan 24 22:58:39 UTC 2012
Darryl,
Per the SortedSet docs: .....null if this set uses the natural ordering of its elements.
Per the NavigableSet.descendingSet docs: "The returned set has an ordering equivalent to Collections.reverseOrder(comparator())"
=====================================
NavigableSet<String> fwd = new TreeSet<String>();
NavigableSet<String> rev = fwd.descendingSet();
System.out.println(fwd.comparator() +" "+ rev.comparator());
=====================================
null java.util.Collections$ReverseComparator at 4b71bbc9
I don't think the spec allows 'null' to mean reverse natural ordering and natural ordering.
Jason
> Date: Tue, 24 Jan 2012 14:18:55 -0800
> From: darryl.mocek at oracle.com
> To: jason_mehrens at hotmail.com
> CC: core-libs-dev at openjdk.java.net
> Subject: Re: Code Review Request Bug #7129185:(coll) Please add Collections.emptyNavigableSet()
>
> emptyNavigableSet().descendingSet().comparator() returns null. Isn't
> this what's expected? The bounds checking should be correct.
>
> Darryl
More information about the core-libs-dev
mailing list