关于Collections.sort的两个小问题
看Tutorial的时候发现有这么一句:If you try to sort a list, the elements of which do not implement Comparable, Collections.sort(list) will throw a ClassCastException.
但真正写了一小段代码的时候是根本编译都通不过,再仔细看sort的声明是这样的:
public static <T extends Comparable<? super T>> void sort(List<T> list) {
1、Tutorial上那句话是不是没说对?
2、sort的声明中static到void之间那个<T extends Comparable<? super T>>是什么意思?(不太懂泛型)