data-collectors
Version:
A collection of composable reduction operations for arbitrary streams of values
14 lines (13 loc) • 699 B
TypeScript
import { Collector, BaseCollector } from "../collector";
import { Mapper } from "../collections/groupingBy";
export declare class MappingCollector<T, U, A, R> extends BaseCollector<T, A, R> {
protected mapper: Mapper<T, U>;
protected collector: Collector<U, A, R>;
constructor(mapper: Mapper<T, U>, collector: Collector<U, A, R>);
supply(): A;
accumulate(container: A, item: T): void;
combine(container1: A, container2: A): A;
finish(container: A): R;
}
export declare function mapping<T, U>(mapper: Mapper<T, U>): Collector<T, U[], U[]>;
export declare function mapping<T, U, A, R>(mapper: Mapper<T, U>, collector?: Collector<U, A, R>): Collector<T, A, R>;