I understand in
Comparator < ? super T> comp
it returns the maximum element of the given collection, according to the order defined by the specified comparator. But I don’t understand the purpose of the
super T
Could anyone possibly explain?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In here
< ? super T>means generics – NOT comparisons.It means you have a
Comparatorwith a generic type of? super T(something thatextendsis super typed byT), as explained in this threadcompis the variable name (binding).So basically in here
Comparator < ? super T>is a type andcompis an identifier (variable name), that is of typeComparator <? super T>For more info: Java Generics