我理解集合的get和put原则:如果一个方法接受一个集合,它将写入一个类型T,参数必须是Collection<? super T>,而如果它将读取一个类型T,参数必须是Collection<? extends T>.
但有人可以解释Collections.max()签名:
public static <T> T max(Collection<? extends T> coll,
Comparator<? super T> comp)
Run Code Online (Sandbox Code Playgroud)
特别是为什么它Comparator<? super T>而不是Comparator<? extends T>?