For example:
static int[] parseIntArray(String[] arr) {
return Stream.of(arr).mapToInt(Integer::parseInt).toArray();
}
So take a Stream
of the String[]
. Use mapToInt
to call Integer.parseInt
for each element and convert to an int
. Then simply call toArray
on the resultant IntStream
to return the array.