Reputation: 25
When this class is created..
public static class TreeNode<E extends Comparable<E>>
what does the <E extends Comparable<E>>
mean?
Upvotes: 1
Views: 670
Reputation: 39992
It means that whenever you create an instance of this class like
TreeNode<MyClass> myTreeNode = new TreeNode<MyClass>();
MyClass must implement Comparable < MyClass >
public class MyClass implements Comparable<MyClass>
{
//CODE
}
Upvotes: 5
Reputation: 245399
That is a generic constraint.
It means that whatever type you store in the TreeNode
must implement the Comparable<E>
interface.
Upvotes: 6