Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
创建此类时..
public static class TreeNode<E extends Comparable<E>>
是什么<E extends Comparable<E>>意思?
<E extends Comparable<E>>
这是一个通用的约束。
这意味着您存储在其中的任何类型都TreeNode必须实现该Comparable<E>接口。
TreeNode
Comparable<E>
这意味着每当您创建此类的实例时
TreeNode<MyClass> myTreeNode = new TreeNode<MyClass>();
MyClass 必须实现 Comparable<MyClass>
public class MyClass implements Comparable<MyClass> { //CODE }