以下示例是关于Java中包含双流操作用法的示例代码,想了解双流操作的具体用法?双流操作怎么用?双流操作使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。
public static int[] arrayDiff(int[] a, int[] b) {
return IntStream.of(a).filter(x -> IntStream.of(b).noneMatch(y -> y == x)).toArray();
}
public static int[] arrayDiff(int[] a, int[] b) {
List<Integer> listA = Arrays.stream(a).boxed().collect(Collectors.toList());
List<Integer> listB = Arrays.stream(b).boxed().collect(Collectors.toList());
listA.removeAll(listB);
return listA.stream().mapToInt(e -> e).toArray();
}
本文地址:https://www.itbaoku.cn/snippets/785119.html