Defining a class like
public class MyRandomList<T extends Comparable>{
List<T> randomList;
}
means we can create a MyRandomList instance with any class that implements Comparable.
MyRandomList<ComparableStudent> l = new MyRandomList<ComparableStudent>();
Where
public class ComparableStudent implements Comparable<ComparableStudent>{
}
Should't the syntax have been <T implements Comparable>
?
Or am I understanding something fundamentally wrong about Java?