Skip to content
Buy me a coffee

Collector

Defined in: src/stream/Collectors.ts:27

A mutable reduction for stream.collect: supplier, accumulator, combiner, finisher and characteristics. The Collector value holds Collector.of and Collector.Characteristics; ready-made ones are in Collectors.

  • Collector<T, A, R>

T

A

R

accumulator(): (container, t) => void

Defined in: src/stream/Collector.ts:22

Returns the function that adds one element to a container.

(container, t) => void

CollectorType.accumulator


characteristics(): Set<CollectorCharacteristics>

Defined in: src/stream/Collector.ts:28

Returns this collector’s characteristics; stream.collect skips the finisher when it contains IDENTITY_FINISH.

Set<CollectorCharacteristics>

CollectorType.characteristics


combiner(): (a, b) => A

Defined in: src/stream/Collector.ts:24

Returns the function that merges two containers and returns the result (either one, or a new container).

(a, b) => A

CollectorType.combiner


finisher(): (container) => R

Defined in: src/stream/Collector.ts:26

Returns the function that turns the final container into the result.

(container) => R

CollectorType.finisher


supplier(): () => A

Defined in: src/stream/Collector.ts:20

Returns the function that creates a new, empty container.

() => A

CollectorType.supplier