I don't think this is a duplicate of Check if a generic T implements an interface, but it may be(??).
So, I want to create a generic interface that only allows objects that implements two interfaces. Alike is a costum interface.
public interface AbstractSortedSimpleList<T extends Comparable<T>, Alike> {}
If I understand it correctly, Java now tries to create a generic interface AbstractSortedSimpleList<T,Alike>
, which isnt exactly what I want to achieve. I want AbstractSortedSimpleList<T>
where T has to implement both Comparable<T>
and Alike
.
Later, I want to make a new class
public class SortedSimpleList<T> implements AbstractSortedSimpleList<T> {}
The point here is to create a class SortedSimpleList<T>
where T has to be implementing the aforementioned interfaces. But my code does not seem to work very well.