Posts

Java 8 Custom Collector

A  mutable reduction operation (takes a sequence of input elements and combines them into a single summary result) that accumulates input elements into a mutable result container, optionally transforming the accumulated result into a final representation after all input elements have been processed. Reduction operations can be performed either sequentially or in parallel. Interface Collector<T, ​A, ​R> Type Parameters: T - the type of input elements to the reduction operation A - the mutable accumulation type of the reduction operation (often hidden as an implementation detail) R - the result type of the reduction operation A Collector is specified by four functions that work together to accumulate entries into a mutable result container, and optionally perform a final transform on the result. They are: creation of a new result container (supplier()) incorporating a new data element into a result container (accumulator()) combining two result containers into one (comb
Recent posts