In Effevtive Java I see a declaration: public static
, type variable T
is a
That means that you will then expect a type that is comparable to Object
, since java infers generic types to be Object
when not provided.
// The generic type for Comparable is inferred as Object as it was not provided.
This means that the type provided to the list would need to implement compareTo(Object o)
and implement Comparable
(notice the missing generic type to Comparable
), which I assume is not intended.