You have:
public class TreeNode<E extends Comparable<E>>
This only says that the E
in TreeNode<E>
should implement Comparable
, not that the TreeNode
itself should. For that you would need to make TreeNode
implement Comparable
in the usual fashion:
public class TreeNode<E extends Comparable<E>> implements Comparable<TreeNode<E>>
And add the appropriate overrides.