You are checking for reference equality rather than object equality. See below for object equality check using Arrays.equals.
int[] a1 = { 1, 2 };
int[] a2 = { 1, 2 };
System.out.println(a1 == a2); // false (two different instances)
System.out.println(Arrays.equals(a1, a2)); // true (instances are logically equal)
Also consider this test:
System.out.println(a1.equals(a2)); // false
For most objects in Java, this would be expected to return true since a1 and a2 are logically equal. However, Array does not override Object.equals(), so it falls back to the default check of reference equality ==. This is the underlying reason why your test if (Arrays.asList(Obstacle).contains(check)) does not pass. Collections.contains() uses Object.equals to compare the arrays. And this is why we must iterate through the outer array manually, as below:
public static int[][] obstacle = { { 1, 3 }, { 2, 2 } };
public static boolean testerFunction(int j, int k) {
int[] check = { j, k };
for (int[] a : obstacle) {
if (Arrays.equals(a, check)) {
return true;
}
}
return false;
}
public static void main(String[] args) {
System.out.println(testerFunction(1, 3)); // true
System.out.println(testerFunction(2, 2)); // true
System.out.println(testerFunction(0, 0)); // false
}