A, Collector Interface interpretation:
Collector Interface Interpretation:
1 public interface Collector<T, A, R> { 2 Supplier<A> supplier(); 3 BiConsumer<A, T> accumulator(); 4 BinaryOperator<A> combiner(); 5 Function<A, R> finisher(); 6 Set<Characteristics> characteristics(); 7 }
Collector <T, A, R & lt>
T: the element type stream;
A: type accumulator, can be thought of a container. To accumulate such as T, into List <T>, A type is List.
R: Final Return Value Type
T IS The Generic type of The items in The Stream to BE Collected.
A IS The type of The ACC with, The Object ON Which The partial Result Will BE Accumulated During The Collection Process.
R & lt IS The type of The object (typically, but not always, the collection) resulting from the collect operation.
Second, Custom Collector, to see how to achieve