LongStream (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

boolean

[allMatch](../../../java/util/stream/LongStream.html#allMatch-java.util.function.LongPredicate-)([LongPredicate](../../../java/util/function/LongPredicate.html "interface in java.util.function") predicate)

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

boolean

[anyMatch](../../../java/util/stream/LongStream.html#anyMatch-java.util.function.LongPredicate-)([LongPredicate](../../../java/util/function/LongPredicate.html "interface in java.util.function") predicate)

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

[DoubleStream](../../../java/util/stream/DoubleStream.html "interface in java.util.stream")

[asDoubleStream](../../../java/util/stream/LongStream.html#asDoubleStream--)()

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

[OptionalDouble](../../../java/util/OptionalDouble.html "class in java.util")

[average](../../../java/util/stream/LongStream.html#average--)()

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

[Stream](../../../java/util/stream/Stream.html "interface in java.util.stream")<[Long](../../../java/lang/Long.html "class in java.lang")>

[boxed](../../../java/util/stream/LongStream.html#boxed--)()

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

static [LongStream.Builder](../../../java/util/stream/LongStream.Builder.html "interface in java.util.stream")

[builder](../../../java/util/stream/LongStream.html#builder--)()

Returns a builder for a LongStream.

<R> R

[collect](../../../java/util/stream/LongStream.html#collect-java.util.function.Supplier-java.util.function.ObjLongConsumer-java.util.function.BiConsumer-)([Supplier](../../../java/util/function/Supplier.html "interface in java.util.function")<R> supplier,[ObjLongConsumer](../../../java/util/function/ObjLongConsumer.html "interface in java.util.function")<R> accumulator,[BiConsumer](../../../java/util/function/BiConsumer.html "interface in java.util.function")<R,R> combiner)

Performs a mutable reduction operation on the elements of this stream.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[concat](../../../java/util/stream/LongStream.html#concat-java.util.stream.LongStream-java.util.stream.LongStream-)([LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream") a,[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream") b)

Creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.

long

[count](../../../java/util/stream/LongStream.html#count--)()

Returns the count of elements in this stream.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[distinct](../../../java/util/stream/LongStream.html#distinct--)()

Returns a stream consisting of the distinct elements of this stream.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[empty](../../../java/util/stream/LongStream.html#empty--)()

Returns an empty sequential LongStream.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[filter](../../../java/util/stream/LongStream.html#filter-java.util.function.LongPredicate-)([LongPredicate](../../../java/util/function/LongPredicate.html "interface in java.util.function") predicate)

Returns a stream consisting of the elements of this stream that match the given predicate.

[OptionalLong](../../../java/util/OptionalLong.html "class in java.util")

[findAny](../../../java/util/stream/LongStream.html#findAny--)()

Returns an OptionalLong describing some element of the stream, or an empty OptionalLong if the stream is empty.

[OptionalLong](../../../java/util/OptionalLong.html "class in java.util")

[findFirst](../../../java/util/stream/LongStream.html#findFirst--)()

Returns an OptionalLong describing the first element of this stream, or an empty OptionalLong if the stream is empty.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[flatMap](../../../java/util/stream/LongStream.html#flatMap-java.util.function.LongFunction-)([LongFunction](../../../java/util/function/LongFunction.html "interface in java.util.function")<? extends [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")> mapper)

Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.

void

[forEach](../../../java/util/stream/LongStream.html#forEach-java.util.function.LongConsumer-)([LongConsumer](../../../java/util/function/LongConsumer.html "interface in java.util.function") action)

Performs an action for each element of this stream.

void

[forEachOrdered](../../../java/util/stream/LongStream.html#forEachOrdered-java.util.function.LongConsumer-)([LongConsumer](../../../java/util/function/LongConsumer.html "interface in java.util.function") action)

Performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[generate](../../../java/util/stream/LongStream.html#generate-java.util.function.LongSupplier-)([LongSupplier](../../../java/util/function/LongSupplier.html "interface in java.util.function") s)

Returns an infinite sequential unordered stream where each element is generated by the provided LongSupplier.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[iterate](../../../java/util/stream/LongStream.html#iterate-long-java.util.function.LongUnaryOperator-)(long seed,[LongUnaryOperator](../../../java/util/function/LongUnaryOperator.html "interface in java.util.function") f)

Returns an infinite sequential ordered LongStream produced by iterative application of a function f to an initial element seed, producing a Stream consisting of seed, f(seed),f(f(seed)), etc.

[PrimitiveIterator.OfLong](../../../java/util/PrimitiveIterator.OfLong.html "interface in java.util")

[iterator](../../../java/util/stream/LongStream.html#iterator--)()

Returns an iterator for the elements of this stream.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[limit](../../../java/util/stream/LongStream.html#limit-long-)(long maxSize)

Returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[map](../../../java/util/stream/LongStream.html#map-java.util.function.LongUnaryOperator-)([LongUnaryOperator](../../../java/util/function/LongUnaryOperator.html "interface in java.util.function") mapper)

Returns a stream consisting of the results of applying the given function to the elements of this stream.

[DoubleStream](../../../java/util/stream/DoubleStream.html "interface in java.util.stream")

[mapToDouble](../../../java/util/stream/LongStream.html#mapToDouble-java.util.function.LongToDoubleFunction-)([LongToDoubleFunction](../../../java/util/function/LongToDoubleFunction.html "interface in java.util.function") mapper)

Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.

[IntStream](../../../java/util/stream/IntStream.html "interface in java.util.stream")

[mapToInt](../../../java/util/stream/LongStream.html#mapToInt-java.util.function.LongToIntFunction-)([LongToIntFunction](../../../java/util/function/LongToIntFunction.html "interface in java.util.function") mapper)

Returns an IntStream consisting of the results of applying the given function to the elements of this stream.

<U> [Stream](../../../java/util/stream/Stream.html "interface in java.util.stream")<U>

[mapToObj](../../../java/util/stream/LongStream.html#mapToObj-java.util.function.LongFunction-)([LongFunction](../../../java/util/function/LongFunction.html "interface in java.util.function")<? extends U> mapper)

Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.

[OptionalLong](../../../java/util/OptionalLong.html "class in java.util")

[max](../../../java/util/stream/LongStream.html#max--)()

Returns an OptionalLong describing the maximum element of this stream, or an empty optional if this stream is empty.

[OptionalLong](../../../java/util/OptionalLong.html "class in java.util")

[min](../../../java/util/stream/LongStream.html#min--)()

Returns an OptionalLong describing the minimum element of this stream, or an empty optional if this stream is empty.

boolean

[noneMatch](../../../java/util/stream/LongStream.html#noneMatch-java.util.function.LongPredicate-)([LongPredicate](../../../java/util/function/LongPredicate.html "interface in java.util.function") predicate)

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

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[of](../../../java/util/stream/LongStream.html#of-long...-)(long... values)

Returns a sequential ordered stream whose elements are the specified values.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[of](../../../java/util/stream/LongStream.html#of-long-)(long t)

Returns a sequential LongStream containing a single element.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[parallel](../../../java/util/stream/LongStream.html#parallel--)()

Returns an equivalent stream that is parallel.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[peek](../../../java/util/stream/LongStream.html#peek-java.util.function.LongConsumer-)([LongConsumer](../../../java/util/function/LongConsumer.html "interface in java.util.function") action)

Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[range](../../../java/util/stream/LongStream.html#range-long-long-)(long startInclusive, long endExclusive)

Returns a sequential ordered LongStream from startInclusive (inclusive) to endExclusive (exclusive) by an incremental step of1.

static [LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[rangeClosed](../../../java/util/stream/LongStream.html#rangeClosed-long-long-)(long startInclusive, long endInclusive)

Returns a sequential ordered LongStream from startInclusive (inclusive) to endInclusive (inclusive) by an incremental step of1.

[OptionalLong](../../../java/util/OptionalLong.html "class in java.util")

[reduce](../../../java/util/stream/LongStream.html#reduce-java.util.function.LongBinaryOperator-)([LongBinaryOperator](../../../java/util/function/LongBinaryOperator.html "interface in java.util.function") op)

Performs a reduction on the elements of this stream, using anassociative accumulation function, and returns an OptionalLong describing the reduced value, if any.

long

[reduce](../../../java/util/stream/LongStream.html#reduce-long-java.util.function.LongBinaryOperator-)(long identity,[LongBinaryOperator](../../../java/util/function/LongBinaryOperator.html "interface in java.util.function") op)

Performs a reduction on the elements of this stream, using the provided identity value and anassociative accumulation function, and returns the reduced value.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[sequential](../../../java/util/stream/LongStream.html#sequential--)()

Returns an equivalent stream that is sequential.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[skip](../../../java/util/stream/LongStream.html#skip-long-)(long n)

Returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream.

[LongStream](../../../java/util/stream/LongStream.html "interface in java.util.stream")

[sorted](../../../java/util/stream/LongStream.html#sorted--)()

Returns a stream consisting of the elements of this stream in sorted order.

[Spliterator.OfLong](../../../java/util/Spliterator.OfLong.html "interface in java.util")

[spliterator](../../../java/util/stream/LongStream.html#spliterator--)()

Returns a spliterator for the elements of this stream.

long

[sum](../../../java/util/stream/LongStream.html#sum--)()

Returns the sum of elements in this stream.

[LongSummaryStatistics](../../../java/util/LongSummaryStatistics.html "class in java.util")

[summaryStatistics](../../../java/util/stream/LongStream.html#summaryStatistics--)()

Returns a LongSummaryStatistics describing various summary data about the elements of this stream.

long[]

[toArray](../../../java/util/stream/LongStream.html#toArray--)()

Returns an array containing the elements of this stream.