Interface LongStream
- All Superinterfaces:
AutoCloseable, 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.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanallMatch(LongPredicate predicate) booleananyMatch(LongPredicate predicate) average()boxed()<R> Rcollect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R, R> combiner) static LongStreamconcat(LongStream a, LongStream b) The elements ofa, then those ofb.longcount()distinct()dropWhile(LongPredicate predicate) static LongStreamempty()filter(LongPredicate predicate) findAny()flatMap(LongFunction<? extends LongStream> mapper) voidforEach(LongConsumer action) voidforEachOrdered(LongConsumer action) static LongStreamThe valuessanswers, one call per element, without end.static LongStreamiterate(long seed, LongPredicate hasNext, LongUnaryOperator next) Asiterate(long, LongUnaryOperator), ending before the first valuehasNextrefuses.static LongStreamiterate(long seed, LongUnaryOperator f) seed, thenfapplied to it, thenfapplied to that, without end.iterator()limit(long maxSize) map(LongUnaryOperator mapper) mapToDouble(LongToDoubleFunction mapper) mapToInt(LongToIntFunction mapper) <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) max()min()booleannoneMatch(LongPredicate predicate) static LongStreamof(long value) static LongStreamof(long... values) parallel()Declared again with this type; seesequential().peek(LongConsumer action) static LongStreamrange(long startInclusive, long endExclusive) The values fromstartInclusiveup to, not including,endExclusive, in steps of one.static LongStreamrangeClosed(long startInclusive, long endInclusive) The values fromstartInclusiveup to and includingendInclusive, in steps of one.longreduce(long identity, LongBinaryOperator op) Declared again with this type, as the JDK does: a call compiled against the JDK namesLongStream.sequential()answeringLongStream, and the method inherited fromBaseStreamanswers its type variable, which is another descriptor.skip(long n) sorted()longsum()takeWhile(LongPredicate predicate) long[]toArray()Methods inherited from interface BaseStream
close, isParallel, onClose, unordered
-
Method Details
-
sequential
LongStream sequential()Declared again with this type, as the JDK does: a call compiled against the JDK namesLongStream.sequential()answeringLongStream, and the method inherited fromBaseStreamanswers its type variable, which is another descriptor.- Specified by:
sequentialin interfaceBaseStream<Long, LongStream>
-
parallel
LongStream parallel()Declared again with this type; seesequential().- Specified by:
parallelin interfaceBaseStream<Long, LongStream>
-
filter
-
map
-
mapToObj
-
mapToInt
-
mapToDouble
-
flatMap
-
distinct
LongStream distinct() -
sorted
LongStream sorted() -
peek
-
limit
-
skip
-
takeWhile
-
dropWhile
-
forEach
-
forEachOrdered
-
toArray
long[] toArray() -
reduce
-
reduce
-
collect
-
sum
long sum() -
min
OptionalLong min() -
max
OptionalLong max() -
count
long count() -
average
OptionalDouble average() -
summaryStatistics
LongSummaryStatistics summaryStatistics() -
anyMatch
-
allMatch
-
noneMatch
-
findFirst
OptionalLong findFirst() -
findAny
OptionalLong findAny() -
asDoubleStream
DoubleStream asDoubleStream() -
boxed
-
iterator
PrimitiveIterator.OfLong iterator()- Specified by:
iteratorin interfaceBaseStream<Long, LongStream>
-
empty
-
of
-
of
-
iterate
seed, thenfapplied to it, thenfapplied to that, without end. -
iterate
Asiterate(long, LongUnaryOperator), ending before the first valuehasNextrefuses. -
generate
The valuessanswers, one call per element, without end. -
range
The values fromstartInclusiveup to, not including,endExclusive, in steps of one. Empty whenstartInclusiveis not belowendExclusive. -
rangeClosed
The values fromstartInclusiveup to and includingendInclusive, in steps of one. Empty whenstartInclusiveis aboveendInclusive. -
concat
The elements ofa, then those ofb. Closing the result closes both.
-