# LongStream

public interface **LongStream** implements [BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html), [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)\> A sequence of primitive long-valued elements supporting sequential and parallel
aggregate operations. This is the `long` primitive specialization of
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html`.

The following example illustrates an aggregate operation using
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html`, 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html` and the package documentation for [java.util.stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary) for additional specification of streams, stream operations, stream pipelines, and parallelism.

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html`
- [java.util.stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary)

### Nested Class Summary

|---|---|---|---|
| interface | [LongStream.Builder](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.Builder.html) || A mutable builder for a `LongStream`. |

### Public Method Summary

|---|---|
| abstract boolean | [allMatch](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#allMatch(java.util.function.LongPredicate))([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate) Returns whether all elements of this stream match the provided predicate. |
| abstract boolean | [anyMatch](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#anyMatch(java.util.function.LongPredicate))([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate) Returns whether any elements of this stream match the provided predicate. |
| abstract [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html) | [asDoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#asDoubleStream())() Returns a `DoubleStream` consisting of the elements of this stream, converted to `double`. |
| abstract [OptionalDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalDouble.html) | [average](https://developers.google.com/j2objc/javadoc/jre/reference/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. |
| abstract [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [boxed](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#boxed())() Returns a `Stream` consisting of the elements of this stream, each boxed to a `Long`. |
| static [LongStream.Builder](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.Builder.html) | [builder](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#builder())() Returns a builder for a `LongStream`. |
| abstract \<R\> R | [collect](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#collect(java.util.function.Supplier<R>,%20java.util.function.ObjLongConsumer<R>,%20java.util.function.BiConsumer<R,%20R>))([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<R\> supplier, [ObjLongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ObjLongConsumer.html)\<R\> accumulator, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<R, R\> combiner) Performs a [mutable reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#MutableReduction) operation on the elements of this stream. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [concat](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#concat(java.util.stream.LongStream,%20java.util.stream.LongStream))([LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) a, [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) 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. |
| abstract long | [count](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#count())() Returns the count of elements in this stream. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [distinct](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#distinct())() Returns a stream consisting of the distinct elements of this stream. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [empty](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#empty())() Returns an empty sequential `LongStream`. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [filter](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#filter(java.util.function.LongPredicate))([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate) Returns a stream consisting of the elements of this stream that match the given predicate. |
| abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html) | [findAny](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#findAny())() Returns an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html` describing some element of the stream, or an empty `OptionalLong` if the stream is empty. |
| abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html) | [findFirst](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#findFirst())() Returns an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html` describing the first element of this stream, or an empty `OptionalLong` if the stream is empty. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [flatMap](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#flatMap(java.util.function.LongFunction<?%20extends%20java.util.stream.LongStream>))([LongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongFunction.html)\<? extends [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)\> 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. |
| abstract void | [forEach](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#forEach(java.util.function.LongConsumer))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) action) Performs an action for each element of this stream. |
| abstract void | [forEachOrdered](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#forEachOrdered(java.util.function.LongConsumer))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [generate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#generate(java.util.function.LongSupplier))([LongSupplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongSupplier.html) s) Returns an infinite sequential unordered stream where each element is generated by the provided `LongSupplier`. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [iterate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#iterate(long,%20java.util.function.LongUnaryOperator))(long seed, [LongUnaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongUnaryOperator.html) 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. |
| abstract [PrimitiveIterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PrimitiveIterator.OfLong.html) | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#iterator())() Returns an iterator for the elements of this stream. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [limit](https://developers.google.com/j2objc/javadoc/jre/reference/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. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#map(java.util.function.LongUnaryOperator))([LongUnaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongUnaryOperator.html) mapper) Returns a stream consisting of the results of applying the given function to the elements of this stream. |
| abstract [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html) | [mapToDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#mapToDouble(java.util.function.LongToDoubleFunction))([LongToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongToDoubleFunction.html) mapper) Returns a `DoubleStream` consisting of the results of applying the given function to the elements of this stream. |
| abstract [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html) | [mapToInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#mapToInt(java.util.function.LongToIntFunction))([LongToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongToIntFunction.html) mapper) Returns an `IntStream` consisting of the results of applying the given function to the elements of this stream. |
| abstract \<U\> [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<U\> | [mapToObj](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#mapToObj(java.util.function.LongFunction<?%20extends%20U>))([LongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongFunction.html)\<? extends U\> mapper) Returns an object-valued `Stream` consisting of the results of applying the given function to the elements of this stream. |
| abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html) | [max](https://developers.google.com/j2objc/javadoc/jre/reference/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. |
| abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html) | [min](https://developers.google.com/j2objc/javadoc/jre/reference/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. |
| abstract boolean | [noneMatch](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#noneMatch(java.util.function.LongPredicate))([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate) Returns whether no elements of this stream match the provided predicate. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [of](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#of(long...))(long... values) Returns a sequential ordered stream whose elements are the specified values. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [of](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#of(long))(long t) Returns a sequential `LongStream` containing a single element. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [parallel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#parallel())() Returns an equivalent stream that is parallel. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [peek](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#peek(java.util.function.LongConsumer))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [range](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#range(long,%20long))(long startInclusive, long endExclusive) Returns a sequential ordered `LongStream` from `startInclusive` (inclusive) to `endExclusive` (exclusive) by an incremental step of `1`. |
| static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [rangeClosed](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#rangeClosed(long,%20long))(long startInclusive, long endInclusive) Returns a sequential ordered `LongStream` from `startInclusive` (inclusive) to `endInclusive` (inclusive) by an incremental step of `1`. |
| abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html) | [reduce](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#reduce(java.util.function.LongBinaryOperator))([LongBinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongBinaryOperator.html) op) Performs a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction) on the elements of this stream, using an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity) accumulation function, and returns an `OptionalLong` describing the reduced value, if any. |
| abstract long | [reduce](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#reduce(long,%20java.util.function.LongBinaryOperator))(long identity, [LongBinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongBinaryOperator.html) op) Performs a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction) on the elements of this stream, using the provided identity value and an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity) accumulation function, and returns the reduced value. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [sequential](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#sequential())() Returns an equivalent stream that is sequential. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/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. |
| abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) | [sorted](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#sorted())() Returns a stream consisting of the elements of this stream in sorted order. |
| abstract [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) | [spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#spliterator())() Returns a spliterator for the elements of this stream. |
| abstract long | [sum](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#sum())() Returns the sum of elements in this stream. |
| abstract [LongSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LongSummaryStatistics.html) | [summaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#summaryStatistics())() Returns a `LongSummaryStatistics` describing various summary data about the elements of this stream. |
| abstract long\[\] | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#toArray())() Returns an array containing the elements of this stream. |

### Inherited Method Summary

From interface [java.util.stream.BaseStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#close())() Closes this stream, causing all close handlers for this stream pipeline to be called. |
| abstract boolean | [isParallel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#isParallel())() Returns whether this stream, if a terminal operation were to be executed, would execute in parallel. |
| abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#iterator())() Returns an iterator for the elements of this stream. |
| abstract S | [onClose](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#onClose(java.lang.Runnable))([Runnable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Runnable.html) closeHandler) Returns an equivalent stream with an additional close handler. |
| abstract S | [parallel](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#parallel())() Returns an equivalent stream that is parallel. |
| abstract S | [sequential](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#sequential())() Returns an equivalent stream that is sequential. |
| abstract [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#spliterator())() Returns a spliterator for the elements of this stream. |
| abstract S | [unordered](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#unordered())() Returns an equivalent stream that is [unordered](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Ordering). |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Public Methods

#### public abstract boolean
**allMatch**
([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate)

Returns whether all elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then `true` is
returned and the predicate is not evaluated.

This is a [short-circuiting
terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| predicate | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) predicate to apply to elements of this stream |
|---|---|

##### Returns

- `true` if either all elements of the stream match the provided predicate or the stream is empty, otherwise `false`

#### public abstract boolean
**anyMatch**
([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate)

Returns whether any elements of this stream match the provided
predicate. May not evaluate the predicate on all elements if not
necessary for determining the result. If the stream is empty then
`false` is returned and the predicate is not evaluated.

This is a [short-circuiting
terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| predicate | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) predicate to apply to elements of this stream |
|---|---|

##### Returns

- `true` if any elements of the stream match the provided predicate, otherwise `false`

#### public abstract [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html)
**asDoubleStream**
()

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- a `DoubleStream` consisting of the elements of this stream, converted to `double`

#### public abstract [OptionalDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalDouble.html)
**average**
()

Returns an `OptionalDouble` describing the arithmetic mean of elements of
this stream, or an empty optional if this stream is empty. This is a
special case of a
[reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction).

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- an `OptionalDouble` containing the average element of this stream, or an empty optional if the stream is empty

#### public abstract [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\>
**boxed**
()

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- a `Stream` consistent of the elements of this stream, each boxed to `Long`

#### public static [LongStream.Builder](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.Builder.html)
**builder**
()

Returns a builder for a `LongStream`.

##### Returns

- a stream builder

#### public abstract R
**collect**
([Supplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Supplier.html)\<R\> supplier, [ObjLongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/ObjLongConsumer.html)\<R\> accumulator, [BiConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/BiConsumer.html)\<R, R\> combiner)

Performs a [mutable
reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#MutableReduction) operation on the elements of this stream. A mutable
reduction is one in which the reduced value is a mutable result container,
such as an `ArrayList`, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:

    R result = supplier.get();
         for (long element : this stream)
             accumulator.accept(result, element);
         return result;
     
Like `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#reduce(long,%20java.util.function.LongBinaryOperator)`, `collect` operations
can be parallelized without requiring additional synchronization.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| supplier | a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time. |
| accumulator | an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity), [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function for incorporating an additional element into a result |
| combiner | an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity), [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function for combining two values, which must be compatible with the accumulator function |
|---|---|

##### Returns

- the result of the reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html#collect(java.util.function.Supplier<R>,%20java.util.function.BiConsumer<R,%20?%20super%20T>,%20java.util.function.BiConsumer<R,%20R>)`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**concat**
([LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) a, [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html) 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. The resulting stream is ordered if both
of the input streams are ordered, and parallel if either of the input
streams is parallel. When the resulting stream is closed, the close
handlers for both input streams are invoked.

##### Parameters

| a | the first stream |
| b | the second stream |
|---|---|

##### Returns

- the concatenation of the two input streams

#### public abstract long
**count**
()

Returns the count of elements in this stream. This is a special case of
a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction) and is
equivalent to:

    return map(e -> 1L).sum();
     
This is a [terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the count of elements in this stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**distinct**
()

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

This is a [stateful
intermediate operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the new stream

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**empty**
()

Returns an empty sequential `LongStream`.

##### Returns

- an empty sequential stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**filter**
([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate)

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| predicate | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) predicate to apply to each element to determine if it should be included |
|---|---|

##### Returns

- the new stream

#### public abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html)
**findAny**
()

Returns an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html` describing some element of the stream, or
an empty `OptionalLong` if the stream is empty.

This is a [short-circuiting
terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

The behavior of this operation is explicitly nondeterministic; it is
free to select any element in the stream. This is to allow for maximal
performance in parallel operations; the cost is that multiple invocations
on the same source may not return the same result. (If a stable result
is desired, use `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#findFirst()` instead.)

##### Returns

- an `OptionalLong` describing some element of this stream, or an empty `OptionalLong` if the stream is empty

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#findFirst()`

#### public abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html)
**findFirst**
()

Returns an `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html` describing the first element of this
stream, or an empty `OptionalLong` if the stream is empty. If the
stream has no encounter order, then any element may be returned.

This is a [short-circuiting
terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- an `OptionalLong` describing the first element of this stream, or an empty `OptionalLong` if the stream is empty

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**flatMap**
([LongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongFunction.html)\<? extends [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)\> 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. Each mapped stream is
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/BaseStream.html#close()` after its contents
have been placed into this stream. (If a mapped stream is `null`
an empty stream is used, instead.)

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| mapper | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function to apply to each element which produces a `LongStream` of new values |
|---|---|

##### Returns

- the new stream

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html#flatMap(java.util.function.Function<?%20super%20T,%20?%20extends%20java.util.stream.Stream<?%20extends%20R>>)`

#### public abstract void
**forEach**
([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) action)

Performs an action for each element of this stream.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

For parallel stream pipelines, this operation does *not*
guarantee to respect the encounter order of the stream, as doing so
would sacrifice the benefit of parallelism. For any given element, the
action may be performed at whatever time and in whatever thread the
library chooses. If the action accesses shared state, it is
responsible for providing the required synchronization.

##### Parameters

| action | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference) action to perform on the elements |
|---|---|

#### public abstract void
**forEachOrdered**
([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) 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.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| action | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference) action to perform on the elements |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#forEach(java.util.function.LongConsumer)`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**generate**
([LongSupplier](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongSupplier.html) s)

Returns an infinite sequential unordered stream where each element is
generated by the provided `LongSupplier`. This is suitable for
generating constant streams, streams of random elements, etc.

##### Parameters

| s | the `LongSupplier` for generated elements |
|---|---|

##### Returns

- a new infinite sequential unordered `LongStream`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**iterate**
(long seed, [LongUnaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongUnaryOperator.html) 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.

The first element (position `0`) in the `LongStream` will
be the provided `seed`. For `n > 0`, the element at position
`n`, will be the result of applying the function `f` to the
element at position `n - 1`.

##### Parameters

| seed | the initial element |
| f | a function to be applied to to the previous element to produce a new element |
|---|---|

##### Returns

- a new sequential `LongStream`

#### public abstract [PrimitiveIterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/PrimitiveIterator.OfLong.html)
**iterator**
()

Returns an iterator for the elements of this stream.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the element iterator for this stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**limit**
(long maxSize)

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

This is a [short-circuiting
stateful intermediate operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| maxSize | the number of elements the stream should be limited to |
|---|---|

##### Returns

- the new stream

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `maxSize` is negative |
|---|---|

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**map**
([LongUnaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongUnaryOperator.html) mapper)

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| mapper | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function to apply to each element |
|---|---|

##### Returns

- the new stream

#### public abstract [DoubleStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/DoubleStream.html)
**mapToDouble**
([LongToDoubleFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongToDoubleFunction.html) mapper)

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| mapper | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function to apply to each element |
|---|---|

##### Returns

- the new stream

#### public abstract [IntStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/IntStream.html)
**mapToInt**
([LongToIntFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongToIntFunction.html) mapper)

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

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| mapper | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function to apply to each element |
|---|---|

##### Returns

- the new stream

#### public abstract [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<U\>
**mapToObj**
([LongFunction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongFunction.html)\<? extends U\> mapper)

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

This is an [intermediate operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| mapper | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function to apply to each element |
|---|---|

##### Returns

- the new stream

#### public abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html)
**max**
()

Returns an `OptionalLong` describing the maximum element of this
stream, or an empty optional if this stream is empty. This is a special
case of a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction)
and is equivalent to:

    return reduce(Long::max);
     
This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- an `OptionalLong` containing the maximum element of this stream, or an empty `OptionalLong` if the stream is empty

#### public abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html)
**min**
()

Returns an `OptionalLong` describing the minimum element of this
stream, or an empty optional if this stream is empty. This is a special
case of a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction)
and is equivalent to:

    return reduce(Long::min);
     
This is a [terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- an `OptionalLong` containing the minimum element of this stream, or an empty `OptionalLong` if the stream is empty

#### public abstract boolean
**noneMatch**
([LongPredicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongPredicate.html) predicate)

Returns whether no elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then `true` is
returned and the predicate is not evaluated.

This is a [short-circuiting
terminal operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| predicate | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) predicate to apply to elements of this stream |
|---|---|

##### Returns

- `true` if either no elements of the stream match the provided predicate or the stream is empty, otherwise `false`

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**of**
(long... values)

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

##### Parameters

| values | the elements of the new stream |
|---|---|

##### Returns

- the new stream

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**of**
(long t)

Returns a sequential `LongStream` containing a single element.

##### Parameters

| t | the single element |
|---|---|

##### Returns

- a singleton sequential stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**parallel**
()

Returns an equivalent stream that is parallel. May return
itself, either because the stream was already parallel, or because
the underlying stream state was modified to be parallel.

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- a parallel stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**peek**
([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) 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.

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

For parallel stream pipelines, the action may be called at
whatever time and in whatever thread the element is made available by the
upstream operation. If the action modifies shared state,
it is responsible for providing the required synchronization.

##### Parameters

| action | a [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference) action to perform on the elements as they are consumed from the stream |
|---|---|

##### Returns

- the new stream

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**range**
(long startInclusive, long endExclusive)

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

##### Parameters

| startInclusive | the (inclusive) initial value |
| endExclusive | the exclusive upper bound |
|---|---|

##### Returns

- a sequential `LongStream` for the range of `long` elements

#### public static [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**rangeClosed**
(long startInclusive, long endInclusive)

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

##### Parameters

| startInclusive | the (inclusive) initial value |
| endInclusive | the inclusive upper bound |
|---|---|

##### Returns

- a sequential `LongStream` for the range of `long` elements

#### public abstract [OptionalLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/OptionalLong.html)
**reduce**
([LongBinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongBinaryOperator.html) op)

Performs a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction) on the
elements of this stream, using an
[associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity) accumulation
function, and returns an `OptionalLong` describing the reduced value,
if any. This is equivalent to:

    boolean foundAny = false;
         long result = null;
         for (long element : this stream) {
             if (!foundAny) {
                 foundAny = true;
                 result = element;
             }
             else
                 result = accumulator.applyAsLong(result, element);
         }
         return foundAny ? OptionalLong.of(result) : OptionalLong.empty();
     
but is not constrained to execute sequentially.

The `accumulator` function must be an
[associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity) function.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| op | an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity), [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function for combining two values |
|---|---|

##### Returns

- the result of the reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#reduce(long,%20java.util.function.LongBinaryOperator)`

#### public abstract long
**reduce**
(long identity, [LongBinaryOperator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongBinaryOperator.html) op)

Performs a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction) on the
elements of this stream, using the provided identity value and an
[associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity)
accumulation function, and returns the reduced value. This is equivalent
to:

    long result = identity;
         for (long element : this stream)
             result = accumulator.applyAsLong(result, element)
         return result;
     
but is not constrained to execute sequentially.

The `identity` value must be an identity for the accumulator
function. This means that for all `x`,
`accumulator.apply(identity, x)` is equal to `x`.
The `accumulator` function must be an
[associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity) function.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| identity | the identity value for the accumulating function |
| op | an [associative](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Associativity), [non-interfering](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#NonInterference), [stateless](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Statelessness) function for combining two values |
|---|---|

##### Returns

- the result of the reduction

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#sum()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#min()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#max()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html#average()`

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**sequential**
()

Returns an equivalent stream that is sequential. May return
itself, either because the stream was already sequential, or because
the underlying stream state was modified to be sequential.

This is an [intermediate
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- a sequential stream

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**skip**
(long n)

Returns a stream consisting of the remaining elements of this stream
after discarding the first `n` elements of the stream.
If this stream contains fewer than `n` elements then an
empty stream will be returned.

This is a [stateful
intermediate operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Parameters

| n | the number of leading elements to skip |
|---|---|

##### Returns

- the new stream

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `n` is negative |
|---|---|

#### public abstract [LongStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/LongStream.html)
**sorted**
()

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

This is a [stateful
intermediate operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the new stream

#### public abstract [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html)
**spliterator**
()

Returns a spliterator for the elements of this stream.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the element spliterator for this stream

#### public abstract long
**sum**
()

Returns the sum of elements in this stream. This is a special case
of a [reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction)
and is equivalent to:

    return reduce(0, Long::sum);
     
This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- the sum of elements in this stream

#### public abstract [LongSummaryStatistics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LongSummaryStatistics.html)
**summaryStatistics**
()

Returns a `LongSummaryStatistics` describing various summary data
about the elements of this stream. This is a special case of a
[reduction](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#Reduction).

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- a `LongSummaryStatistics` describing various summary data about the elements of this stream

#### public abstract long\[\]
**toArray**
()

Returns an array containing the elements of this stream.

This is a [terminal
operation](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/package-summary#StreamOps).

##### Returns

- an array containing the elements of this stream