I'm new to Java 8 and currently failing to grasp Streams fully, is it possible to fill an array using the Stream functional operations? This is an example code of how I would do it with a standard for loop:
public static void testForLoop(){
String[][] array = new String[3][3];
for (int x = 0; x < array.length; x++){
for (int y = 0; y < array[x].length; y++){
array[x][y] = String.format("%c%c", letter(x), letter(y));
}
}
}
public static char letter(int i){
return letters.charAt(i);
}
If it is possible how would I do it using Stream? If it is possible, is it convenient (performance and readability wise)?
array[x].length
for the inner loop.