Hi Amir,
Given signature) public static <T extends Comparable<? super T>> void sort(List<T> list)
First of all this generic method. A generic method should have the signature
like ex: public <T> void display(List<T> list)
<T> before return type is a must for generic method and can be used to filter some unwanted inputs types.
step 1) Suppose we call like this
List<
String> list = New ArrayList();
list.add("Kathy");
list.add("Bert");
list.add("SCJP");
Collections.sort(list);
step 2)
newly generated signature >>
public static <String extends Comparable<? super String>> void sort(List<String> list)
step 3)
filter condition : <String extends Comparable<? super String> means
1) String should extend Comparable interface(here extend can also be used for interface.) So String will pass this test.and one more
2) Comparable<? super String> means sort method can add Strings to our list<String>.
Hope its very clear. This one has clear explanation in K&B book.
and see also what <? extends T> is used for. K&B book has given Best explanation on why its introduced.
All the best