I am trying to do something similar, but Java will not allow me. I suspect I'm just doing something wrong, but I really don't know what.
public interface PopulationMember extends Comparable<T extends PopulationMember> {
int compareTo(T o);
T merge(T o);
}
It seems that T should be a class, not a generic type. My question is similar to this , but not exactly the same. The bottom line is that I want to have a type where I can compare it with other things of the same subtype, without being able to compare them with any other PopulationMember object.
source
share