I'm trying to instanciate an abstract class and it doesn't work.
abstract class Links<T> implements List<T>{
}
Links<Link> notVisitedLinks = new ArrayList<Link>();
I also tested the Links class as not an abstract class and it tells me the following error message :
Links is not an abstract class and it doesn't override abstract method subList(int, int) in List
class Links<T> implements List<T>{
}
Links<Link> notVisitedLinks = new ArrayList<Link>();
I tried to undersand how to override the subList method but I did'nt succeed.
You're getting an error because ArrayList doesn't match up with Links. Even though ArrayList fits with List, it's not quite the same as Links, even though Links expands List.
One fix could be making a regular class that expands Links and adds the needed methods. Like this:
In this code:
ConcreteLinks is a regular class that extends Links and fills in the required methods of the List interface. notVisitedLinks is an instance of ConcreteLinks, so you can treat it like a list of Link objects.