摘要: 只保留 b 中不包含的值。 阅读全文
posted @ 2018-02-03 01:57 R4mble 阅读(161) 评论(0) 推荐(0) 编辑
摘要: public static int[] deepFlatten(Object[] input) { return Arrays.stream(input) .flatMapToInt(o -> { if (o instanceof Object[]) { return Arrays.strea... 阅读全文
posted @ 2018-02-03 01:43 R4mble 阅读(114) 评论(0) 推荐(0) 编辑
摘要: public static long countOccurrences(int[] numbers, int value) { return Arrays.stream(numbers) .filter(number -> number == value) .count(); } 阅读全文
posted @ 2018-02-03 01:20 R4mble 阅读(299) 评论(0) 推荐(0) 编辑
摘要: public static T[] concat(T[] first, T[] second) { return Stream.concat( Stream.of(first), Stream.of(second) ).toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, first... 阅读全文
posted @ 2018-02-03 01:09 R4mble 阅读(157) 评论(0) 推荐(0) 编辑
摘要: public static int[][] chunk(int[] numbers, int size) { return IntStream.iterate(0, i -> i + size) .limit((long) Math.ceil((double) numbers.length / size)) //返回大于或等于... 阅读全文
posted @ 2018-02-03 00:15 R4mble 阅读(420) 评论(0) 推荐(0) 编辑