If I have the following code:
public interface BinaryTree<T extends Comparable<? super T>>{}
It means that it’s an interface that accepts object that implement Comparable right?
What does <?Super T> means?
And the next thing, If I want to write an implementation to BinaryTree
How should the class deceleration look like?
<? super T>means “any superclass (or superinterface) of T” (as @GETah has quoted the docs.)So, your class will look something like
public class MyBinaryTree<T extends Comparable<? super T>> implements BinaryTree<T> {...}– you need to specify the generic parameter of MyBinaryTree to be compatible with that required by the interface.