Update Print2DArray.java
This commit is contained in:
parent
b8c875adbd
commit
b62e4d4baf
@ -20,4 +20,17 @@ public class Print2DArray{
|
|||||||
public static void print2DDeepToString(int[][] myArray){
|
public static void print2DDeepToString(int[][] myArray){
|
||||||
System.out.println(Arrays.deepToString(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user