(五)返回两个数组之间的差异

mac2022-06-30  24

public static int[] difference(int[] first, int[] second) { Set<Integer> set = Arrays.stream(second).boxed().collect(Collectors.toSet()); return Arrays.stream(first) .filter(v -> !set.contains(v)) .toArray(); }

 只保留 b 中不包含的值。

转载于:https://www.cnblogs.com/R4mble/p/8408265.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)