LongStream

public interface LongStream
implements BaseStream<LongLongStream>

java.util.stream.LongStream


A sequence of primitive long-valued elements supporting sequential and parallel aggregate operations. This is the long primitive specialization of Stream.

The following example illustrates an aggregate operation using Stream and LongStream, computing the sum of the weights of the red widgets:

long sum = widgets.stream()
                       .filter(w -> w.getColor() == RED)
                       .mapToLong(w -> w.getWeight())
                       .sum();
 
See the class documentation for Stream and the package documentation for java.util.stream for additional specification of streams, stream operations, stream pipelines, and parallelism.

Summary

Nested classes

interface LongStream.Builder

A mutable builder for a LongStream

interface LongStream.LongMapMultiConsumer

Represents an operation that accepts a long-valued argument and a LongConsumer, and returns no result. 

Public methods

abstract boolean allMatch(LongPredicate predicate)

Returns whether all elements of this stream match the provided predicate.

abstract boolean anyMatch(LongPredicate predicate)

Returns whether any elements of this stream match the provided predicate.

abstract DoubleStream asDoubleStream()

Returns a DoubleStream consisting of the elements of this stream, converted to double.

abstract OptionalDouble average()

Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.

abstract Stream<Long> boxed()

Returns a Stream consisting of the elements of this stream, each boxed to a Long.

static LongStream.Builder builder()

Returns a builder for a LongStream.

abstract <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R, R> combiner)

Performs a