Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public interface LongStream

ExtendsAutoCloseable, BaseStream<Long, LongStream>

A sequence of long values to which operations are applied one stage at a time, evaluated lazily, one element at a time, when a terminal operation asks for them.

Streams here are sequential: parallel() answers the same stream, which the JDK allows a parallel stream to be.

Methods

public abstract LongStream sequential()Declared again with this type, as the JDK does: a call compiled against the JDK names LongStream.sequential() answering LongStream, and the method inherited from BaseStream answers its type variable, which is another descriptor.
public abstract LongStream parallel()Declared again with this type; see sequential().
public abstract LongStream filter(LongPredicate predicate)
public abstract LongStream map(LongUnaryOperator mapper)
public abstract <U> Stream<U> mapToObj(LongFunction<? extends U> mapper)
public abstract IntStream mapToInt(LongToIntFunction mapper)
public abstract DoubleStream mapToDouble(LongToDoubleFunction mapper)
public abstract LongStream flatMap(LongFunction<? extends LongStream> mapper)
public abstract LongStream distinct()
public abstract LongStream sorted()
public abstract LongStream peek(LongConsumer action)
public abstract LongStream limit(long maxSize)
public abstract LongStream skip(long n)
public abstract LongStream takeWhile(LongPredicate predicate)
public abstract LongStream dropWhile(LongPredicate predicate)
public abstract void forEach(LongConsumer action)
public abstract void forEachOrdered(LongConsumer action)
public abstract long[] toArray()
public abstract long reduce(long identity, LongBinaryOperator op)
public abstract OptionalLong reduce(LongBinaryOperator op)
public abstract <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R, R> combiner)
public abstract long sum()
public abstract OptionalLong min()
public abstract OptionalLong max()
public abstract long count()
public abstract OptionalDouble average()
public abstract LongSummaryStatistics summaryStatistics()
public abstract boolean anyMatch(LongPredicate predicate)
public abstract boolean allMatch(LongPredicate predicate)
public abstract boolean noneMatch(LongPredicate predicate)
public abstract OptionalLong findFirst()
public abstract OptionalLong findAny()
public abstract DoubleStream asDoubleStream()
public abstract Stream<Long> boxed()
public abstract PrimitiveIterator.OfLong iterator()
public static LongStream empty()
public static LongStream of(long value)
public static LongStream of(long... values)
public static LongStream iterate(long seed, LongUnaryOperator f)seed, then f applied to it, then f applied to that, without end.
public static LongStream iterate(long seed, LongPredicate hasNext, LongUnaryOperator next)As iterate(long, LongUnaryOperator), ending before the first value hasNext refuses.
public static LongStream generate(LongSupplier s)The values s answers, one call per element, without end.
public static LongStream range(long startInclusive, long endExclusive)The values from startInclusive up to, not including, endExclusive, in steps of one.
public static LongStream rangeClosed(long startInclusive, long endInclusive)The values from startInclusive up to and including endInclusive, in steps of one.
public static LongStream concat(LongStream a, LongStream b)The elements of a, then those of b.

Inherited methods

Method details

sequential

public abstract LongStream sequential()
Declared again with this type, as the JDK does: a call compiled against the JDK names LongStream.sequential() answering LongStream, and the method inherited from BaseStream answers its type variable, which is another descriptor.

parallel

public abstract LongStream parallel()
Declared again with this type; see sequential().

filter

public abstract LongStream filter(LongPredicate predicate)

map

public abstract LongStream map(LongUnaryOperator mapper)

mapToObj

public abstract <U> Stream<U> mapToObj(LongFunction<? extends U> mapper)

mapToInt

public abstract IntStream mapToInt(LongToIntFunction mapper)

mapToDouble

public abstract DoubleStream mapToDouble(LongToDoubleFunction mapper)

flatMap

public abstract LongStream flatMap(LongFunction<? extends LongStream> mapper)

distinct

public abstract LongStream distinct()

sorted

public abstract LongStream sorted()

peek

public abstract LongStream peek(LongConsumer action)

limit

public abstract LongStream limit(long maxSize)

skip

public abstract LongStream skip(long n)

takeWhile

public abstract LongStream takeWhile(LongPredicate predicate)

dropWhile

public abstract LongStream dropWhile(LongPredicate predicate)

forEach

public abstract void forEach(LongConsumer action)

forEachOrdered

public abstract void forEachOrdered(LongConsumer action)

toArray

public abstract long[] toArray()

reduce

public abstract long reduce(long identity, LongBinaryOperator op)

reduce

public abstract OptionalLong reduce(LongBinaryOperator op)

collect

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

sum

public abstract long sum()

min

public abstract OptionalLong min()

max

public abstract OptionalLong max()

count

public abstract long count()

average

public abstract OptionalDouble average()

summaryStatistics

public abstract LongSummaryStatistics summaryStatistics()

anyMatch

public abstract boolean anyMatch(LongPredicate predicate)

allMatch

public abstract boolean allMatch(LongPredicate predicate)

noneMatch

public abstract boolean noneMatch(LongPredicate predicate)

findFirst

public abstract OptionalLong findFirst()

findAny

public abstract OptionalLong findAny()

asDoubleStream

public abstract DoubleStream asDoubleStream()

boxed

public abstract Stream<Long> boxed()

iterator

public abstract PrimitiveIterator.OfLong iterator()

empty

public static LongStream empty()

of

public static LongStream of(long value)

of

public static LongStream of(long... values)

iterate

public static LongStream iterate(long seed, LongUnaryOperator f)
seed, then f applied to it, then f applied to that, without end.

iterate

public static LongStream iterate(long seed, LongPredicate hasNext, LongUnaryOperator next)
As iterate(long, LongUnaryOperator), ending before the first value hasNext refuses.

generate

public static LongStream generate(LongSupplier s)
The values s answers, one call per element, without end.

range

public static LongStream range(long startInclusive, long endExclusive)
The values from startInclusive up to, not including, endExclusive, in steps of one. Empty when startInclusive is not below endExclusive.

rangeClosed

public static LongStream rangeClosed(long startInclusive, long endInclusive)
The values from startInclusive up to and including endInclusive, in steps of one. Empty when startInclusive is above endInclusive.

concat

public static LongStream concat(LongStream a, LongStream b)
The elements of a, then those of b. Closing the result closes both.