How to convert ArrayList to array in Java?

I've been working quite a lot in Java. Although this is part of the university course, we actually have some QAs we need to satisfy, and so the quality of the code matters. Every now and again (more often than not actually), I came across painfully annoying constructs which make the code that much harder to read and write. Like today, I wanted to convert an ArrayList to a simple array. The array would be used for SOAP (code generated by Apache Axis1). Well... One would think that a simple toArray() would do it:

Apparently not. You need something along the lines of:

Yeah... The Java Way.

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box