Update Print2DArray.java

This commit is contained in:
Neetika23 2023-11-21 17:35:23 +05:30 committed by GitHub
parent b8c875adbd
commit b62e4d4baf
1 changed files with 13 additions and 0 deletions

View File

@ -20,4 +20,17 @@ public class Print2DArray{
public static void print2DDeepToString(int[][] myArray){
System.out.println(Arrays.deepToString(myArray));
}
public static void printArrayAsList(int[][] myArray) {
for (int[] row : myArray) {
List<Integer> rowList = Arrays.asList(Arrays.stream(row).boxed().toArray(Integer[]::new));
System.out.println(rowList);
}
}
public static void printArrayString(int[][] myArray) {
for (int[] row : myArray) {
System.out.println(Arrays.toString(row));
}
}
}