File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Convert Integer[] to int[] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Convert Integer[] to int[]" Watch "Convert Integer[] to int[]" New topic
Author

Convert Integer[] to int[]

Hans Dampf
Greenhorn

Joined: Nov 26, 2005
Posts: 2
Hello,

does anybody know how I can convert an array of Integers into an array of ints without looping over every array element? Thank You very much.

Regards,
Hans
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Originally posted by Hans Dampf:
Hello,

does anybody know how I can convert an array of Integers into an array of ints without looping over every array element? Thank You very much.

Regards,
Hans


No, nobody does.
The existance of primitive types is a language defect, which is why the require 'workaround' is counter-intuitive.


Tony Morris
Java Q&A (FAQ, Trivia)
Hans Dampf
Greenhorn

Joined: Nov 26, 2005
Posts: 2
Hello Tony,

thank you very much for your reply. I've feared that there would be no "compact" solution.

Regards,
Hans
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
I agree, there is no "compact" solution in the API, AFAIK.

I was playing around with some java.util stuff and I wrote the
following code. Not surprising in retrospect, but it caught me off-guard.

[ November 28, 2005: Message edited by: Jeff Albrechtsen ]

There is no emoticon for what I am feeling!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Integer[] to int[]
 
Similar Threads
String array to arraylist
String to int
how to convert byte array into short??
how to store map value in string array
Returning byte array to JavaScript from Java applet