Code Review Request Bug #7129185:(coll) Please add Collections.emptyNavigableSet() (original) (raw)

Darryl Mocek darryl.mocek at oracle.com
Tue Jan 24 22🔞55 UTC 2012


emptyNavigableSet().descendingSet().comparator() returns null. Isn't this what's expected? The bounds checking should be correct.

Darryl

On Tue 24 Jan 2012 01:29:30 PM PST, Jason Mehrens wrote:

> > 3. What if I want to create an empty set navigable set with supplied > > comparator? Extending is not an option. > This is the one issue I wanted to discuss...is this necessary? I was > thinking about how this would be implemented. You would need to supply > a comparator to the emptyNavigableSet. Other empty* methods don't take > parameters and adding a method to supply a comparator would require an > additional method.

I think you have little choice but to add the parameter because the current implementation of emptyNavigableSet().descendingSet().comparator() returns the wrong value. Which should mean that the bounds checking is incorrect in the descendingSet too. Am I correct on that? So by adding that feature you don't have to create a special subclass to correctly implement EmptyNavigableSet. Jason



More information about the core-libs-dev mailing list