Skip to content
Buy me a coffee

DoubleStream

Defined in: src/stream/Streams.ts:41

A stream of floating-point numbers with compensated sums. The DoubleStream value holds the factories.

  • DoubleStream

[dispose](): void

Defined in: src/stream/Stream.ts:71

Calls close(), so using s = ... closes the stream at the end of the block. Present where the runtime has Symbol.dispose.

void

DoubleStreamType.[dispose]


[iterator](): Iterator<number, any, any>

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:47

Iterator<number, any, any>

DoubleStreamType.[iterator]


allMatch(predicate): boolean

Defined in: src/stream/Stream.ts:382

Returns whether all numbers match predicate; true when empty. Terminal, short-circuiting.

(n) => boolean

boolean

DoubleStreamType.allMatch


anyMatch(predicate): boolean

Defined in: src/stream/Stream.ts:380

Returns whether any number matches predicate; false when empty. Terminal, short-circuiting.

(n) => boolean

boolean

DoubleStreamType.anyMatch


average(): OptionalDouble

Defined in: src/stream/Stream.ts:378

Returns the arithmetic mean, or an empty OptionalDouble for an empty stream. Terminal.

OptionalDouble

DoubleStreamType.average


boxed(): Stream<number>

Defined in: src/stream/Stream.ts:390

Returns a Stream of the same numbers, to use object-stream operations such as collect(collector). Intermediate.

Stream<number>

DoubleStreamType.boxed


close(): void

Defined in: src/stream/Stream.ts:69

Closes the stream and runs its close handlers once, in registration order. If handlers throw, the rest still run and the first error is rethrown with later ones attached via suppressed. A terminal operation does not close the stream; closing a closed stream does nothing.

void

DoubleStreamType.close


collect<R>(supplier, accumulator, combiner): R

Defined in: src/stream/Stream.ts:368

Performs a mutable reduction into the container supplier creates and returns it. Terminal. Only this three-argument form exists (call boxed() first to use a Collector); a one-argument call throws IllegalArgumentException.

R

() => R

(r, n) => void

(a, b) => void

R

DoubleStreamType.collect


count(): number

Defined in: src/stream/Stream.ts:376

Returns the number of elements; computed without traversal when the size is known exactly. Terminal.

number

DoubleStreamType.count


distinct(): DoubleStream

Defined in: src/stream/Stream.ts:325

Returns a stream without duplicate numbers, keeping the first occurrence. Intermediate, stateful. NaN equals NaN; in a DoubleStream -0 and 0 are different values.

DoubleStream

DoubleStreamType.distinct


dropWhile(predicate): DoubleStream

Defined in: src/stream/Stream.ts:346

Returns the numbers after the longest prefix matching predicate. Intermediate, stateful.

(n) => boolean

DoubleStream

DoubleStreamType.dropWhile


filter(predicate): DoubleStream

Defined in: src/stream/Stream.ts:309

Returns a stream of the numbers that match predicate. Intermediate, stateless.

(n) => boolean

DoubleStream

DoubleStreamType.filter


findAny(): OptionalDouble

Defined in: src/stream/Stream.ts:388

Returns some number, or an empty optional; always the first here (sequential evaluation). Terminal, short-circuiting.

OptionalDouble

DoubleStreamType.findAny


findFirst(): OptionalDouble

Defined in: src/stream/Stream.ts:386

Returns the first number, or an empty optional. Terminal, short-circuiting.

OptionalDouble

DoubleStreamType.findFirst


flatMap(mapper): DoubleStream

Defined in: src/stream/Stream.ts:318

Returns a stream that replaces each number with the numbers of the stream mapper returns. Intermediate. A null/undefined result counts as empty; each mapped stream is closed after use.

(n) => DoubleStream | null | undefined

DoubleStream

DoubleStreamType.flatMap


forEach(action): void

Defined in: src/stream/Stream.ts:348

Runs action for each number in encounter order. Terminal.

(n) => void

void

DoubleStreamType.forEach


forEachOrdered(action): void

Defined in: src/stream/Stream.ts:350

Runs action for each number in encounter order. Terminal; here the same as forEach.

(n) => void

void

DoubleStreamType.forEachOrdered


isParallel(): boolean

Defined in: src/stream/Stream.ts:44

Returns true if parallel() was requested. It only reports the flag; evaluation is always sequential.

boolean

DoubleStreamType.isParallel


iterator(): PrimitiveIteratorOfDouble

Defined in: src/stream/Stream.ts:436

Returns a PrimitiveIteratorOfDouble over the elements; a terminal operation that does not close the stream.

PrimitiveIteratorOfDouble

DoubleStreamType.iterator


limit(maxSize): DoubleStream

Defined in: src/stream/Stream.ts:337

Returns a stream of at most the first maxSize numbers. Intermediate, stateful and short-circuiting.

number

DoubleStream

IllegalArgumentException if maxSize is negative or not an integer

DoubleStreamType.limit


map(mapper): DoubleStream

Defined in: src/stream/Stream.ts:311

Returns a stream of mapper applied to each number. Intermediate, stateless.

(n) => number

DoubleStream

DoubleStreamType.map


mapMulti(mapper): DoubleStream

Defined in: src/stream/Stream.ts:320

Returns a stream of the numbers mapper passes to consumer, zero or more per element. Intermediate, stateless.

(n, consumer) => void

DoubleStream

DoubleStreamType.mapMulti


mapToInt(mapper): IntStream

Defined in: src/stream/Stream.ts:438

Returns an IntStream of mapper applied to each element. Intermediate.

(n) => number

IntStream

DoubleStreamType.mapToInt


mapToLong(mapper): LongStream

Defined in: src/stream/Stream.ts:440

Returns a LongStream of mapper applied to each element. Intermediate.

(n) => number

LongStream

DoubleStreamType.mapToLong


mapToObj<U>(mapper): Stream<U>

Defined in: src/stream/Stream.ts:313

Returns a Stream of mapper applied to each number. Intermediate, stateless.

U

(n) => U

Stream<U>

DoubleStreamType.mapToObj


max(): OptionalDouble

Defined in: src/stream/Stream.ts:374

Returns the largest number (as Math.max: NaN wins), or an empty optional. Terminal.

OptionalDouble

DoubleStreamType.max


min(): OptionalDouble

Defined in: src/stream/Stream.ts:372

Returns the smallest number (as Math.min: NaN wins), or an empty optional. Terminal.

OptionalDouble

DoubleStreamType.min


noneMatch(predicate): boolean

Defined in: src/stream/Stream.ts:384

Returns whether no number matches predicate; true when empty. Terminal, short-circuiting.

(n) => boolean

boolean

DoubleStreamType.noneMatch


onClose(closeHandler): DoubleStream

Defined in: src/stream/Stream.ts:63

Registers a handler run by close() and returns this same stream; handlers run in registration order.

() => void

DoubleStream

IllegalStateException if the stream was already operated upon or closed

NullPointerException if closeHandler is null

DoubleStreamType.onClose


parallel(): DoubleStream

Defined in: src/stream/Stream.ts:51

Sets the parallel flag and returns this same stream. Evaluation stays sequential on the single JS thread; code written for parallel streams (associative reducers, combiners, findAny) gives the same results.

DoubleStream

DoubleStreamType.parallel


peek(action): DoubleStream

Defined in: src/stream/Stream.ts:332

Returns a stream that runs action on each number as it passes. Intermediate, stateless; meant for debugging.

(n) => void

DoubleStream

DoubleStreamType.peek


reduce(identity, op): number

Defined in: src/stream/Stream.ts:357

Folds the numbers, starting from identity, with an associative op. Terminal.

number

(a, b) => number

number

the result, or identity for an empty stream

DoubleStreamType.reduce

reduce(op): OptionalDouble

Defined in: src/stream/Stream.ts:362

Folds the numbers with an associative op, without an initial value. Terminal.

(a, b) => number

OptionalDouble

the result, or an empty number optional for an empty stream

DoubleStreamType.reduce


sequential(): DoubleStream

Defined in: src/stream/Stream.ts:46

Clears the parallel flag and returns this same stream. Allowed on a stream that was already used.

DoubleStream

DoubleStreamType.sequential


skip(n): DoubleStream

Defined in: src/stream/Stream.ts:342

Returns a stream without the first n numbers (this same stream when n is 0). Intermediate, stateful.

number

DoubleStream

IllegalArgumentException if n is negative or not an integer

DoubleStreamType.skip


sorted(): DoubleStream

Defined in: src/stream/Stream.ts:330

Returns a stream sorted in ascending numeric order (-0 before 0). Intermediate and a stateful barrier. There is no comparator form: use boxed().sorted(cmp); passing one from JS throws IllegalArgumentException.

DoubleStream

DoubleStreamType.sorted


spliterator(): Spliterator<number>

Defined in: src/stream/Stream.ts:42

Returns a Spliterator over the stream’s elements; a terminal operation that pulls elements lazily. It reports the pipeline’s characteristics (ORDERED, DISTINCT, SORTED, SIZED / SUBSIZED as the stages keep them); with no stages it is the source spliterator itself.

Spliterator<number>

IllegalStateException if the stream was already operated upon or closed

DoubleStreamType.spliterator


sum(): number

Defined in: src/stream/Stream.ts:370

Returns the sum of the numbers, 0 for an empty stream. Terminal.

number

DoubleStreamType.sum


summaryStatistics(): DoubleSummaryStatistics

Defined in: src/stream/Stream.ts:442

Returns the count, sum, min, max and average in one pass (compensated sums). Terminal.

DoubleSummaryStatistics

DoubleStreamType.summaryStatistics


takeWhile(predicate): DoubleStream

Defined in: src/stream/Stream.ts:344

Returns the longest prefix of numbers matching predicate. Intermediate, short-circuiting.

(n) => boolean

DoubleStream

DoubleStreamType.takeWhile


toArray(): number[]

Defined in: src/stream/Stream.ts:352

Returns a new JS array of the numbers in encounter order. Terminal.

number[]

DoubleStreamType.toArray


unordered(): DoubleStream

Defined in: src/stream/Stream.ts:57

Returns an equivalent stream without the encounter-order constraint (an intermediate operation), or this stream itself when it is already unordered. Evaluation is sequential, so elements still arrive in source order.

DoubleStream

IllegalStateException if the stream was already operated upon or closed

DoubleStreamType.unordered