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 中不包含的值。
标签:return div blog cond integer [] 包含 enc public
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 中不包含的值。
标签:return div blog cond integer [] 包含 enc public
原文地址:https://www.cnblogs.com/R4mble/p/8408265.html