Deep copying a 2d array in Java
Can someone guide me, how to perform a deep copy of a boolean array? I tried using .clone() on my 2d boolean array but it was a fail. Any suggestions are welcomed. How java copy 2d array?
To copy 2d array copying you will have to iterate over your 2 dimensional array. You can refer the following code for the same:
public static boolean[][] deepCopy(boolean[][] org) {
if (org == null) {
return null;
}
final boolean[][] res = new boolean[org.length][];
for (int i = 0; i < org xss=removed>