T reduce(T identity, BinaryOperator<T> accumulator);
Optional<T> reduce(BinaryOperator<T> accumulator);
<U> U reduce(U identity,
BiFunction<U, ? super T, U> accumulator,
BinaryOperator<U> combiner);
collect(转换成集合)
<R> R collect(Supplier<R> supplier,
BiConsumer<R, ? super T> accumulator,
BiConsumer<R, R> combiner);
<R, A> R collect(Collector<? super T, A, R> collector);
转list
// 转list
Collectors.toList();
// 转set
Collectors.toSet();
// 转map
List<TestVo> testList = new ArrayList<>(10);
Map<Long, TestVo> data = releaseList.stream()
.collect(Collectors.toMap(TestVo::getId, x -> x));
count(计数)
long count();
查找
boolean anyMatch(Predicate<? super T> predicate);
boolean allMatch(Predicate<? super T> predicate);
boolean noneMatch(Predicate<? super T> predicate);