一只萌萌小番薯
可以使用流().anyMatch() 来执行此检查:int[][] coorArray = {{1,2},{2,2},{3,0}};int[] coor = {1,2};boolean exist = Arrays.stream(coorArray).anyMatch(e -> Arrays.equals(e, coor));System.out.println("exist = " + exist); 输出:exist = true否则,当输入数组中不存在坐标时:int[][] coorArray = {{4,2},{2,2},{3,0}};int[] coor = {1,2};boolean exist = Arrays.stream(coorArray).anyMatch(e -> Arrays.equals(e, coor));System.out.println("exist = " + exist);输出:exist = false