Convert an ArrayList to an object array

Posted by marionmaiden on Stack Overflow See other posts from Stack Overflow or by marionmaiden
Published on 2010-04-30T14:47:48Z Indexed on 2010/04/30 14:57 UTC
Read the original article Hit count: 205

Filed under:
|
|
|

Hello,

Is there a command in java for conversion of an ArrayList into a object array. I know how to do this copying each object from the arrayList into the object array, but I was wondering if would it be done automatically.

I want something like this:

ArrayList<TypeA> a;

// Let's imagine "a" was filled with TypeA objects

TypeA[] array = MagicalCommand(a);

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist