R
rmacnak
What is the difference between List<Whatever> and List<? extends
Whatever>?
Whatever>?
What is the difference between List<Whatever> and List<? extends
Whatever>?
Sounds like it would be useful if Whatever is an abstract class or
interface. If you used ArrayList<Whatever> in this case and added an
instanace of Whatever to the list and then tried to execute an abstract
method you would get a runtime error. By using ArrayList<? extends
Whatever> if you tried to do this you would get a compile time error.
Cool.
What is the difference between List<Whatever> and List<? extends
Whatever>?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.