Initializing 2d array with streams in Java
问题 I have the following class: public class MyClass{ //... public MyClass(int x, int y){ //... } } Now, I need to initialize 2d-array with the items int rows; int cols; //initializing rows and cols MyClass[][] arr = new MyClass[rows][cols]; //how to initialize arr[x][y] with //new MyClass(x, y) with streams API I looked at this example but it doesn't work in my case. They use a single IntStream QUESTION: Of course I can use nested for loops, but I think it's now old-style and is considering bad.