Java solution using record & stream
\npublic int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        List<Cell> cells = new ArrayList<>();\n\n        for (int row = 0; r
```\npublic int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        List<Cell> cells = new ArrayList<>();\n\n        for (int row = 0; row < rows; ++row)\n            for (int column = 0; column < cols; ++column)\n                cells.add(new Cell(row, column, Math.abs(row - rCenter) + Math.abs(column - cCenter)));\n\n        return cells.stream().sorted(Comparator.comparing(Cell::distance)).map(cell -> new int[]{cell.row(), cell.column()}).toArray(int[][]::new);\n    }\n\n    private record Cell(int row, int column, int distance) {}\n```
['Java']