| 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
|
posted

0
|
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
|
posted

0
|
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!
|
 |
 |
|
|
subject: Convert Integer[] to int[]
|
|
|