Issue
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
Could anyone possibly explain?
Solution
In here < ? super T>
means generics - NOT comparisons.
It means you have a Comparator
with a generic type of ? super T
(something that extends is super typed by T
), as explained in this thread
comp
is the variable name (binding).
So basically in here Comparator < ? super T>
is a type and comp
is an identifier (variable name), that is of type Comparator <? super T>
For more info: Java Generics
Answered By - amit
Answer Checked By - Marilyn (JavaFixing Volunteer)