Is there any comprehensive way to invoke a method on every value in a an array without having to create a for loop? It seems like it would be trivial, but I am unable to find anything.
For example:
class Foo{
public static void main(String[] args){
String[] arr = {"1","2","3"};
int[] intarr = new int[arr.length];
for(int i = 0; i < arr.length; i++){
intarr[i] = Integer.parseInt(arr[i]);
}
}
}
is there any way to do this without a for loop?
whileloop?