标签:static span .so nal min rpo ora combiner ram
1.The collect is declared by the Interface of Stream.The param is Collector Interface.
<R, A> R collect(Collector<? super T, A, R> collector);
2.The Collector Interface mainly contains 4 functions about:
(1)creation of a new result container ({@link #supplier()})
(2)incorporating a new data element into a result container ({@link #accumulator()})
(3)combining two result containers into one ({@link #combiner()})
(4)performing an optional final transform on the container ({@link #finisher()}
3.The Collectors Class has a inner class which implements above Collector.So you can invoke collect by this assistant class (Collectors).The Collectors class implement some common operations.
ex:
public static <T> Collector<T, ?, List<T>> toList() { return new CollectorImpl<>((Supplier<List<T>>) ArrayList::new, List::add, (left, right) -> { left.addAll(right); return left; }, CH_ID); }
标签:static span .so nal min rpo ora combiner ram
原文地址:http://www.cnblogs.com/huiGod/p/6880642.html