It's instructive to (try and) create such a method yourself in order to see what happens. Something along the lines of:
public class Foo<E> {
private E data;
// get() is...
Type: Posts; User: pbrockway2
It's instructive to (try and) create such a method yourself in order to see what happens. Something along the lines of:
public class Foo<E> {
private E data;
// get() is...
I agree.
You'd think that an ArrayList<Foo> would have commonsense enough to return a Foo[] when told to convert itself toArray(). But all knowledge of its Foo-ness is erased away at runtime. ...
You'll get a runtime exception if you try and cast an array of Object to an array of Player. That's why Collection provides the toArray(T[]) method as well. Try
return...