Java 树集构造函数

Java 树集构造函数,java,comparator,Java,Comparator,据此: TreeSet类中有2个构造函数: TreeSet(Collection<? extends E> c) TreeSet(Comparator<? super E> comparator) 谢谢。您正在使用此构造函数: TreeSet(Comparator<? super E> comparator) 当然,传递的对象由TreeSet内部使用,以执行其比较。您正在使用此构造函数: TreeSet(Comparator<? super E&g

据此:

TreeSet类中有2个构造函数:

TreeSet(Collection<? extends E> c)
TreeSet(Comparator<? super E> comparator)

谢谢。

您正在使用此构造函数:

TreeSet(Comparator<? super E> comparator)

当然,传递的对象由
TreeSet
内部使用,以执行其比较。

您正在使用此构造函数:

TreeSet(Comparator<? super E> comparator)
当然,
TreeSet
在内部使用传递的对象来执行比较

TreeSet(Comparator<? super E> comparator)
new TreeSet<>(new Sorted(1, "c"));
public class Sorted implements Comparable<Sorted>, Comparator<Sorted>