Hi all, first comment here in javaranch =).
Well, i have a dude in generics and wilcards.
The next is not allowed=
List<Animal> list = new ArrayList<Dog>()
Of course, polymorphism with generics get us to a nice compiler error.
But with wilcards, isnt it the same?
List<? extends Animal> list = new ArrayList<Dog>();
is ok, i think...
But with return types, is this ok?
public List<? extends Animal> maybeGetDogs(List<Animal>
List<Dog> dog = maybeGetDogs(animals);
And about the code wich wrote our friend in the first post, what does it throw? I think compiler error, because in runtime there arent generics...
-A pleasure write here.Thanks for all, and sorry for my english
-spanish, lot of sun and beach and bulls, but bad english.