I have a String[], where each element is convertible to an integer. What's the best way I can convert this to an int[]?
int[] StringArrayToIntArray(String[] s)
{
... ? ...
}
I have a String[], where each element is convertible to an integer. What's the best way I can convert this to an int[]?
int[] StringArrayToIntArray(String[] s)
{
... ? ...
}
convert String[] to Integer[] in java 8:
Integer[] myArray = Stream.of(new String[] { "1", "2", "3" })
.map(Integer::parseInt)
.toArray(Integer[]::new);