Closed GoogleCodeExporter closed 9 years ago
We're trying not to duplicate what's already in Java's Collections class:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#reverse(java.
util.List)
In the next snapshot, there will be a class called Ordering, which adds
additional features to any Comparator
that extends it. One such feature is reverse(), so you can do this, for example:
new TreeSet<String>(Comparators.naturalOrder().reverse())
Original comment by limpbizkit
on 25 Nov 2007 at 4:02
Thanks for the info, looking forward to the next snapshot then!
When it comes to duplication, one scenario (and this was actually my case) where
reversing collections is not equivalent to reversing comparators is when you
need to
"reverse" one or more comparators you use to build a compound comparator.
Original comment by stac...@gmail.com
on 25 Nov 2007 at 4:21
I think Jesse gave the wrong reference by mistake; the method he means is
Collections.reverseOrder().
Original comment by kevin...@gmail.com
on 25 Nov 2007 at 6:03
Oh, good point, thanks!
Original comment by stac...@gmail.com
on 25 Nov 2007 at 6:06
Original issue reported on code.google.com by
stac...@gmail.com
on 25 Nov 2007 at 3:11