I have an Animal.Class and Dog class which extends Animal.Class
May I know if there is a quick and easy way to do this?
List<Dog> dogList = getAnimalList();
public List<Animal> getAnimalList(){
List<Animal> animalList = new LinkedList<Animal>();
return animalList;
}
I don’t wish to look the entire animal List again unless absolutely necessary.
The dog class just contain an extra boolean value for other checking purpose.
Generics inheritance is little different than java inheritance principle. You need to use
?(wildcards)EDIT:
Wildcard Guidelines: