Top Description Fields Constructors Methods
org.hibernate.query.spi

public Class IntStreamDecorator

extends Object
implements IntStream
Class Inheritance
All Implemented Interfaces
java.util.stream.IntStream, java.util.stream.BaseStream, java.lang.AutoCloseable
Annotations
@Incubating
Imports
java.util.IntSummaryStatistics, .OptionalDouble, .OptionalInt, .PrimitiveIterator, .Spliterator, java.util.function.BiConsumer, .IntBinaryOperator, .IntConsumer, .IntFunction, .IntPredicate, .IntToDoubleFunction, .IntToLongFunction, .IntUnaryOperator, .ObjIntConsumer, .Supplier, java.util.stream.DoubleStream, .IntStream, .LongStream, .Stream, org.hibernate.Incubating

The IntStreamDecorator wraps a Java IntStream and registers a closeHandler which is passed further to any resulting Stream.

The goal of the IntStreamDecorator is to close the underlying IntStream upon calling a terminal operation.

Author
Vlad Mihalcea
Since
5.4

Field Summary

Modifier and TypeField and Description
private final Runnable
private final IntStream

Constructor Summary

AccessConstructor and Description
public
IntStreamDecorator(IntStream delegate, Runnable closeHandler)

Method Summary

Modifier and TypeMethod and Description
public boolean
allMatch(IntPredicate
a non-interfering, stateless predicate to apply to elements of this stream
predicate
)

Implements java.util.stream.IntStream.allMatch.

Returns whether all elements of this stream match the provided predicate.
public boolean
anyMatch(IntPredicate
a non-interfering, stateless predicate to apply to elements of this stream
predicate
)

Implements java.util.stream.IntStream.anyMatch.

Returns whether any elements of this stream match the provided predicate.
public DoubleStream
asDoubleStream()

Implements java.util.stream.IntStream.asDoubleStream.

Returns a DoubleStream consisting of the elements of this stream, converted to double.
public LongStream
asLongStream()

Implements java.util.stream.IntStream.asLongStream.

Returns a LongStream consisting of the elements of this stream, converted to long.
public OptionalDouble
average()

Implements java.util.stream.IntStream.average.

Returns an OptionalDouble describing the arithmetic mean of elements of this stream, or an empty optional if this stream is empty.
public Stream<Integer>
boxed()

Implements java.util.stream.IntStream.boxed.

Returns a Stream consisting of the elements of this stream, each boxed to an Integer.
public void
close()

Implements java.util.stream.BaseStream.close.

Closes this stream, causing all close handlers for this stream pipeline to be called.
public <R> R
collect(Supplier<R>
a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time.
supplier
,
ObjIntConsumer<R>
an associative, non-interfering, stateless function that must fold an element into a result container.
accumulator
,
BiConsumer<R, R>
an associative, non-interfering, stateless function that accepts two partial result containers and merges them, which must be compatible with the accumulator function. The combiner function must fold the elements from the second result container into the first result container.
combiner
)

Implements java.util.stream.IntStream.collect.

Performs a mutable reduction operation on the elements of this stream.
public long
count()

Implements java.util.stream.IntStream.count.

Returns the count of elements in this stream.
public IntStream
distinct()

Implements java.util.stream.IntStream.distinct.

Returns a stream consisting of the distinct elements of this stream.
public IntStream
filter(IntPredicate
a non-interfering, stateless predicate to apply to each element to determine if it should be included
predicate
)

Implements java.util.stream.IntStream.filter.

Returns a stream consisting of the elements of this stream that match the given predicate.
public OptionalInt
findAny()

Implements java.util.stream.IntStream.findAny.

Returns an OptionalInt describing some element of the stream, or an empty OptionalInt if the stream is empty.
public OptionalInt
findFirst()

Implements java.util.stream.IntStream.findFirst.

Returns an OptionalInt describing the first element of this stream, or an empty OptionalInt if the stream is empty.
public IntStream
flatMap(IntFunction<? extends IntStream>
a non-interfering, stateless function to apply to each element which produces an IntStream of new values
mapper
)

Implements java.util.stream.IntStream.flatMap.

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.
public void
forEach(IntConsumer
a non-interfering action to perform on the elements
action
)

Implements java.util.stream.IntStream.forEach.

Performs an action for each element of this stream.
public void
forEachOrdered(IntConsumer
a non-interfering action to perform on the elements
action
)

Implements java.util.stream.IntStream.forEachOrdered.

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.
public boolean
isParallel()

Implements java.util.stream.BaseStream.isParallel.

Returns whether this stream, if a terminal operation were to be executed, would execute in parallel.
public PrimitiveIterator.OfInt
iterator()

Implements java.util.stream.IntStream.iterator.

Returns an iterator for the elements of this stream.
public IntStream
limit(long
the number of elements the stream should be limited to
maxSize
)

Implements java.util.stream.IntStream.limit.

Returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length.
public IntStream
map(IntUnaryOperator
a non-interfering, stateless function to apply to each element
mapper
)

Implements java.util.stream.IntStream.map.

Returns a stream consisting of the results of applying the given function to the elements of this stream.
public DoubleStream
mapToDouble(IntToDoubleFunction
a non-interfering, stateless function to apply to each element
mapper
)

Implements java.util.stream.IntStream.mapToDouble.

Returns a DoubleStream consisting of the results of applying the given function to the elements of this stream.
public LongStream
mapToLong(IntToLongFunction
a non-interfering, stateless function to apply to each element
mapper
)

Implements java.util.stream.IntStream.mapToLong.

Returns a LongStream consisting of the results of applying the given function to the elements of this stream.
public <U> Stream<U>
mapToObj(IntFunction<? extends U>
a non-interfering, stateless function to apply to each element
mapper
)

Implements java.util.stream.IntStream.mapToObj.

Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.
public OptionalInt
max()

Implements java.util.stream.IntStream.max.

Returns an OptionalInt describing the maximum element of this stream, or an empty optional if this stream is empty.
public OptionalInt
min()

Implements java.util.stream.IntStream.min.

Returns an OptionalInt describing the minimum element of this stream, or an empty optional if this stream is empty.
public boolean
noneMatch(IntPredicate
a non-interfering, stateless predicate to apply to elements of this stream
predicate
)

Implements java.util.stream.IntStream.noneMatch.

Returns whether no elements of this stream match the provided predicate.
public IntStream
onClose(Runnable
A task to execute when the stream is closed
closeHandler
)

Implements java.util.stream.BaseStream.onClose.

Returns an equivalent stream with an additional close handler.
public IntStream
parallel()

Implements java.util.stream.IntStream.parallel.

Returns an equivalent stream that is parallel.
public IntStream
peek(IntConsumer
a non-interfering action to perform on the elements as they are consumed from the stream
action
)

Implements java.util.stream.IntStream.peek.

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.
public int
reduce(int
the identity value for the accumulating function
identity
,
IntBinaryOperator
an associative, non-interfering, stateless function for combining two values
op
)

Implements java.util.stream.IntStream.reduce.

Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value.
public OptionalInt
reduce(IntBinaryOperator
an associative, non-interfering, stateless function for combining two values
op
)

Implements java.util.stream.IntStream.reduce.

Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalInt describing the reduced value, if any.
public IntStream
sequential()

Implements java.util.stream.IntStream.sequential.

Returns an equivalent stream that is sequential.
public IntStream
skip(long
the number of leading elements to skip
n
)

Implements java.util.stream.IntStream.skip.

Returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream.
public IntStream
sorted()

Implements java.util.stream.IntStream.sorted.

Returns a stream consisting of the elements of this stream in sorted order.
public Spliterator.OfInt
spliterator()

Implements java.util.stream.IntStream.spliterator.

Returns a spliterator for the elements of this stream.
public int
sum()

Implements java.util.stream.IntStream.sum.

Returns the sum of elements in this stream.
public IntSummaryStatistics
summaryStatistics()

Implements java.util.stream.IntStream.summaryStatistics.

Returns an IntSummaryStatistics describing various summary data about the elements of this stream.
public int[]
toArray()

Implements java.util.stream.IntStream.toArray.

Returns an array containing the elements of this stream.
public IntStream
unordered()

Implements java.util.stream.BaseStream.unordered.

Returns an equivalent stream that is unordered.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closeHandlerback to summary
private final Runnable closeHandler
delegateback to summary
private final IntStream delegate

Constructor Detail

IntStreamDecoratorback to summary
public IntStreamDecorator(IntStream delegate, Runnable closeHandler)

Method Detail

allMatchback to summary
public boolean allMatch(IntPredicate predicate)

Implements java.util.stream.IntStream.allMatch.

Doc from java.util.stream.IntStream.allMatch.

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.

Parameters
predicate:IntPredicate

a non-interfering, stateless predicate to apply to elements of this stream

Returns:boolean

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

Annotations
@Override
anyMatchback to summary
public boolean anyMatch(IntPredicate predicate)

Implements java.util.stream.IntStream.anyMatch.

Doc from java.util.stream.IntStream.anyMatch.

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.

Parameters
predicate:IntPredicate

a non-interfering, stateless predicate to apply to elements of this stream

Returns:boolean

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

Annotations
@Override
asDoubleStreamback to summary
public DoubleStream asDoubleStream()

Implements java.util.stream.IntStream.asDoubleStream.

Doc from java.util.stream.IntStream.asDoubleStream.

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

This is an intermediate operation.

Returns:DoubleStream

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

Annotations
@Override
asLongStreamback to summary
public LongStream asLongStream()

Implements java.util.stream.IntStream.asLongStream.

Doc from java.util.stream.IntStream.asLongStream.

Returns a LongStream consisting of the elements of this stream, converted to long.

This is an intermediate operation.

Returns:LongStream

a LongStream consisting of the elements of this stream, converted to long

Annotations
@Override
averageback to summary
public OptionalDouble average()

Implements java.util.stream.IntStream.average.

Doc from java.util.stream.IntStream.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.

This is a terminal operation.

Returns:OptionalDouble

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

Annotations
@Override
boxedback to summary
public Stream<Integer> boxed()

Implements java.util.stream.IntStream.boxed.

Doc from java.util.stream.IntStream.boxed.

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

This is an intermediate operation.

Returns:Stream<Integer>

a Stream consistent of the elements of this stream, each boxed to an Integer

Annotations
@Override
closeback to summary
public void close()

Implements java.util.stream.BaseStream.close.

Doc from java.util.stream.BaseStream.close.

Closes this stream, causing all close handlers for this stream pipeline to be called.

Annotations
@Override
collectback to summary
public <R> R collect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R, R> combiner)

Implements java.util.stream.IntStream.collect.

Doc from java.util.stream.IntStream.collect.

Performs a mutable reduction 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 (int element : this stream)
        accumulator.accept(result, element);
    return result;

Like reduce(int, IntBinaryOperator), collect operations can be parallelized without requiring additional synchronization.

This is a terminal operation.

Parameters
<R>
the type of the mutable result container
supplier:Supplier<R>

a function that creates a new mutable result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time.

accumulator:ObjIntConsumer<R>

an associative, non-interfering, stateless function that must fold an element into a result container.

combiner:BiConsumer<R, R>

an associative, non-interfering, stateless function that accepts two partial result containers and merges them, which must be compatible with the accumulator function. The combiner function must fold the elements from the second result container into the first result container.

Returns:R

the result of the reduction

Annotations
@Override
countback to summary
public long count()

Implements java.util.stream.IntStream.count.

Doc from java.util.stream.IntStream.count.

Returns the count of elements in this stream. This is a special case of a reduction and is equivalent to:

return mapToLong(e -> 1L).sum();

This is a terminal operation.

Returns:long

the count of elements in this stream

Annotations
@Override
distinctback to summary
public IntStream distinct()

Implements java.util.stream.IntStream.distinct.

Doc from java.util.stream.IntStream.distinct.

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

This is a stateful intermediate operation.

Returns:IntStream

the new stream

Annotations
@Override
filterback to summary
public IntStream filter(IntPredicate predicate)

Implements java.util.stream.IntStream.filter.

Doc from java.util.stream.IntStream.filter.

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

This is an intermediate operation.

Parameters
predicate:IntPredicate

a non-interfering, stateless predicate to apply to each element to determine if it should be included

Returns:IntStream

the new stream

Annotations
@Override
findAnyback to summary
public OptionalInt findAny()

Implements java.util.stream.IntStream.findAny.

Doc from java.util.stream.IntStream.findAny.

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

This is a short-circuiting terminal operation.

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 findFirst() instead.)

Returns:OptionalInt

an OptionalInt describing some element of this stream, or an empty OptionalInt if the stream is empty

Annotations
@Override
findFirstback to summary
public OptionalInt findFirst()

Implements java.util.stream.IntStream.findFirst.

Doc from java.util.stream.IntStream.findFirst.

Returns an OptionalInt describing the first element of this stream, or an empty OptionalInt 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.

Returns:OptionalInt

an OptionalInt describing the first element of this stream, or an empty OptionalInt if the stream is empty

Annotations
@Override
flatMapback to summary
public IntStream flatMap(IntFunction<? extends IntStream> mapper)

Implements java.util.stream.IntStream.flatMap.

Doc from java.util.stream.IntStream.flatMap.

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 closed 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.

Parameters
mapper:IntFunction<? extends IntStream>

a non-interfering, stateless function to apply to each element which produces an IntStream of new values

Returns:IntStream

the new stream

Annotations
@Override
forEachback to summary
public void forEach(IntConsumer action)

Implements java.util.stream.IntStream.forEach.

Doc from java.util.stream.IntStream.forEach.

Performs an action for each element of this stream.

This is a terminal operation.

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:IntConsumer

a non-interfering action to perform on the elements

Annotations
@Override
forEachOrderedback to summary
public void forEachOrdered(IntConsumer action)

Implements java.util.stream.IntStream.forEachOrdered.

Doc from java.util.stream.IntStream.forEachOrdered.

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.

Parameters
action:IntConsumer

a non-interfering action to perform on the elements

Annotations
@Override
isParallelback to summary
public boolean isParallel()

Implements java.util.stream.BaseStream.isParallel.

Doc from java.util.stream.BaseStream.isParallel.

Returns whether this stream, if a terminal operation were to be executed, would execute in parallel. Calling this method after invoking an terminal stream operation method may yield unpredictable results.

Returns:boolean

true if this stream would execute in parallel if executed

Annotations
@Override
iteratorback to summary
public PrimitiveIterator.OfInt iterator()

Implements java.util.stream.IntStream.iterator.

Doc from java.util.stream.BaseStream.iterator.

Returns an iterator for the elements of this stream.

This is a terminal operation.

Returns:PrimitiveIterator.OfInt

the element iterator for this stream

Annotations
@Override
limitback to summary
public IntStream limit(long maxSize)

Implements java.util.stream.IntStream.limit.

Doc from java.util.stream.IntStream.limit.

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.

Parameters
maxSize:long

the number of elements the stream should be limited to

Returns:IntStream

the new stream

Annotations
@Override
mapback to summary
public IntStream map(IntUnaryOperator mapper)

Implements java.util.stream.IntStream.map.

Doc from java.util.stream.IntStream.map.

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

This is an intermediate operation.

Parameters
mapper:IntUnaryOperator

a non-interfering, stateless function to apply to each element

Returns:IntStream

the new stream

Annotations
@Override
mapToDoubleback to summary
public DoubleStream mapToDouble(IntToDoubleFunction mapper)

Implements java.util.stream.IntStream.mapToDouble.

Doc from java.util.stream.IntStream.mapToDouble.

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

This is an intermediate operation.

Parameters
mapper:IntToDoubleFunction

a non-interfering, stateless function to apply to each element

Returns:DoubleStream

the new stream

Annotations
@Override
mapToLongback to summary
public LongStream mapToLong(IntToLongFunction mapper)

Implements java.util.stream.IntStream.mapToLong.

Doc from java.util.stream.IntStream.mapToLong.

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

This is an intermediate operation.

Parameters
mapper:IntToLongFunction

a non-interfering, stateless function to apply to each element

Returns:LongStream

the new stream

Annotations
@Override
mapToObjback to summary
public <U> Stream<U> mapToObj(IntFunction<? extends U> mapper)

Implements java.util.stream.IntStream.mapToObj.

Doc from java.util.stream.IntStream.mapToObj.

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.

Parameters
<U>
the element type of the new stream
mapper:IntFunction<? extends U>

a non-interfering, stateless function to apply to each element

Returns:Stream<U>

the new stream

Annotations
@Override
maxback to summary
public OptionalInt max()

Implements java.util.stream.IntStream.max.

Doc from java.util.stream.IntStream.max.

Returns an OptionalInt describing the maximum element of this stream, or an empty optional if this stream is empty. This is a special case of a reduction and is equivalent to:

return reduce(Integer::max);

This is a terminal operation.

Returns:OptionalInt

an OptionalInt containing the maximum element of this stream, or an empty OptionalInt if the stream is empty

Annotations
@Override
minback to summary
public OptionalInt min()

Implements java.util.stream.IntStream.min.

Doc from java.util.stream.IntStream.min.

Returns an OptionalInt describing the minimum element of this stream, or an empty optional if this stream is empty. This is a special case of a reduction and is equivalent to:

return reduce(Integer::min);

This is a terminal operation.

Returns:OptionalInt

an OptionalInt containing the minimum element of this stream, or an empty OptionalInt if the stream is empty

Annotations
@Override
noneMatchback to summary
public boolean noneMatch(IntPredicate predicate)

Implements java.util.stream.IntStream.noneMatch.

Doc from java.util.stream.IntStream.noneMatch.

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.

Parameters
predicate:IntPredicate

a non-interfering, stateless predicate to apply to elements of this stream

Returns:boolean

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

Annotations
@Override
onCloseback to summary
public IntStream onClose(Runnable closeHandler)

Implements java.util.stream.BaseStream.onClose.

Doc from java.util.stream.BaseStream.onClose.

Returns an equivalent stream with an additional close handler. Close handlers are run when the close() method is called on the stream, and are executed in the order they were added. All close handlers are run, even if earlier close handlers throw exceptions. If any close handler throws an exception, the first exception thrown will be relayed to the caller of close(), with any remaining exceptions added to that exception as suppressed exceptions (unless one of the remaining exceptions is the same exception as the first exception, since an exception cannot suppress itself.) May return itself.

This is an intermediate operation.

Parameters
closeHandler:Runnable

A task to execute when the stream is closed

Returns:IntStream

a stream with a handler that is run if the stream is closed

Annotations
@Override
parallelback to summary
public IntStream parallel()

Implements java.util.stream.IntStream.parallel.

Doc from java.util.stream.BaseStream.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.

Returns:IntStream

a parallel stream

Annotations
@Override
peekback to summary
public IntStream peek(IntConsumer action)

Implements java.util.stream.IntStream.peek.

Doc from java.util.stream.IntStream.peek.

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.

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:IntConsumer

a non-interfering action to perform on the elements as they are consumed from the stream

Returns:IntStream

the new stream

Annotations
@Override
reduceback to summary
public int reduce(int identity, IntBinaryOperator op)

Implements java.util.stream.IntStream.reduce.

Doc from java.util.stream.IntStream.reduce.

Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value. This is equivalent to:

int result = identity;
    for (int element : this stream)
        result = accumulator.applyAsInt(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 function.

This is a terminal operation.

Parameters
identity:int

the identity value for the accumulating function

op:IntBinaryOperator

an associative, non-interfering, stateless function for combining two values

Returns:int

the result of the reduction

Annotations
@Override
reduceback to summary
public OptionalInt reduce(IntBinaryOperator op)

Implements java.util.stream.IntStream.reduce.

Doc from java.util.stream.IntStream.reduce.

Performs a reduction on the elements of this stream, using an associative accumulation function, and returns an OptionalInt describing the reduced value, if any. This is equivalent to:

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

The accumulator function must be an associative function.

This is a terminal operation.

Parameters
op:IntBinaryOperator

an associative, non-interfering, stateless function for combining two values

Returns:OptionalInt

the result of the reduction

Annotations
@Override
sequentialback to summary
public IntStream sequential()

Implements java.util.stream.IntStream.sequential.

Doc from java.util.stream.BaseStream.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.

Returns:IntStream

a sequential stream

Annotations
@Override
skipback to summary
public IntStream skip(long n)

Implements java.util.stream.IntStream.skip.

Doc from java.util.stream.IntStream.skip.

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.

Parameters
n:long

the number of leading elements to skip

Returns:IntStream

the new stream

Annotations
@Override
sortedback to summary
public IntStream sorted()

Implements java.util.stream.IntStream.sorted.

Doc from java.util.stream.IntStream.sorted.

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

This is a stateful intermediate operation.

Returns:IntStream

the new stream

Annotations
@Override
spliteratorback to summary
public Spliterator.OfInt spliterator()

Implements java.util.stream.IntStream.spliterator.

Doc from java.util.stream.BaseStream.spliterator.

Returns a spliterator for the elements of this stream.

This is a terminal operation.

Returns:Spliterator.OfInt

the element spliterator for this stream

Annotations
@Override
sumback to summary
public int sum()

Implements java.util.stream.IntStream.sum.

Doc from java.util.stream.IntStream.sum.

Returns the sum of elements in this stream. This is a special case of a reduction and is equivalent to:

return reduce(0, Integer::sum);

This is a terminal operation.

Returns:int

the sum of elements in this stream

Annotations
@Override
summaryStatisticsback to summary
public IntSummaryStatistics summaryStatistics()

Implements java.util.stream.IntStream.summaryStatistics.

Doc from java.util.stream.IntStream.summaryStatistics.

Returns an IntSummaryStatistics describing various summary data about the elements of this stream. This is a special case of a reduction.

This is a terminal operation.

Returns:IntSummaryStatistics

an IntSummaryStatistics describing various summary data about the elements of this stream

Annotations
@Override
toArrayback to summary
public int[] toArray()

Implements java.util.stream.IntStream.toArray.

Doc from java.util.stream.IntStream.toArray.

Returns an array containing the elements of this stream.

This is a terminal operation.

Returns:int[]

an array containing the elements of this stream

Annotations
@Override
unorderedback to summary
public IntStream unordered()

Implements java.util.stream.BaseStream.unordered.

Doc from java.util.stream.BaseStream.unordered.

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

This is an intermediate operation.

Returns:IntStream

an unordered stream

Annotations
@Override