Search:

Type: Posts; User: pbrockway2

Search: Search took 0.11 seconds.

  1. Replies
    8
    Views
    1,807

    Re: Do Class Casts Work With Arrays?

    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...
  2. Replies
    8
    Views
    1,807

    Re: Do Class Casts Work With Arrays?

    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. ...
  3. Replies
    8
    Views
    1,807

    Re: Do Class Casts Work With Arrays?

    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...
Results 1 to 3 of 3