I have an array of arrays - similar to this:
import java.util.Arrays;
public class test {
public static void main(String[] args)
{
String[][] A = { { "a", "b", "c" }, { "d", "e", "f" }, { "g", "h", "-" } };
String[][] B = { { "-", "e", "b" }, { "a", "h", "c" }, { "d", "g", "f" } };
String[][] C = { { "a", "b", "c" }, { "d", "e", "f" }, { "g", "h", "-" } };
String[][][] myArray = { A, B};
for (String[][] s : myArray) {
System.out.println(Arrays.deepToString(s));
if (Arrays.deepToString(s).equals(Arrays.deepToString(C))) {
System.out.println("true");
}
}
}
}
I need to check if a value is in the array, however, this is the only method I have found to work and it is very inefficient.
Is there a better way to do this since most built-in methods do not appear to work?
I also tried to use a Set and that had the same issues.