Reputation: 627
Trying to write my class as shown below gives a compilation error
public class CustomTreeSet<T extends Comparable<T>> implements SortedSet<T extends Comparable<T>> {
}
Error:
Syntax error on token "extends", , expected
The error occurs at the extends token here:
SortedSet<T extends Comparable<T>>
Can you help me figure out how do I make my class work with Comparable types only. Thanks!!
Upvotes: 1
Views: 93
Reputation: 393916
You should only declare the generic type parameter T (and its type bound once) :
public class CustomTreeSet<T extends Comparable<T>> implements SortedSet<T> {
Upvotes: 3