I'm having a weird issue here it seems. I have an interface, known as Sortable
. I then have another class, like so:
public class LeftSort {
private List<Sortable> list;
public <T extends Sortable> LeftSort(List<T> list) {
this.list = list;
}
}
However when I go to make another class, called Foo
, like so:
public class Foo implements Sortable {}
When doing the following in a JUnit test:
List<Foo> list = new ArrayList<Foo>();
// Initialise... blah blah.
LeftSort sorter = new LeftSort(list);
I receive the following error:
The constructor LeftSort(List<Foo>) is undefined.
I swear you're able to use interfaces in generics like I have done so. Is there anything I've done wrong here?
I've also messed around with doing private List<? extends Sortable> list;
too but to no avail.
Edit: Please make note in the future to check which class your actually importing prior to complaining like me. I simply had the wrong class imported (Foo is just the name I gave it online, it was actually Test that I so smartly decided to use...)