I\'ve read the whole SCJP6 book Sierra and Bates book, scored 88% the exam.
But still, i never heard of how this kind of code works as it\'s not explained in the generic
Just a small addition to the other responses.
When getting the according compiler error:
While the "traditional" casting approach
(Comparator) Collections.reverseOrder()
looks similar to the generics approach
Collections.reverseOrder()
the casting approach is of course not type-safe (possible runtime exception), while the generics approach would create a compilation error, if there is an issue. Thus the generics approach is preferred, of course.