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

Modifier and Type

Method

Description

boolean

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

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

boolean

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

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

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

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

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

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

[asLongStream](../../../java/util/stream/IntStream.html#asLongStream--)()

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

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

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

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

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

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

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

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

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

Returns a builder for an IntStream.

<R> R

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

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

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

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

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

long

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

Returns the count of elements in this stream.

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

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

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

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

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

Returns an empty sequential IntStream.

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

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

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

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

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

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

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

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

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

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

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

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

void

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

Performs an action for each element of this stream.

void

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

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

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

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

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

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

[iterate](../../../java/util/stream/IntStream.html#iterate-int-java.util.function.IntUnaryOperator-)(int seed,[IntUnaryOperator](../../../java/util/function/IntUnaryOperator.html "interface in java.util.function") f)

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

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

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

Returns an iterator for the elements of this stream.

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

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

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

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

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

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

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

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

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

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

[mapToLong](../../../java/util/stream/IntStream.html#mapToLong-java.util.function.IntToLongFunction-)([IntToLongFunction](../../../java/util/function/IntToLongFunction.html "interface in java.util.function") mapper)

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

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

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

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

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

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

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

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

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

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

boolean

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

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

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

[of](../../../java/util/stream/IntStream.html#of-int...-)(int... values)

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

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

[of](../../../java/util/stream/IntStream.html#of-int-)(int t)

Returns a sequential IntStream containing a single element.

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

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

Returns an equivalent stream that is parallel.

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

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

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

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

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

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

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

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

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

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

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

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

int

[reduce](../../../java/util/stream/IntStream.html#reduce-int-java.util.function.IntBinaryOperator-)(int identity,[IntBinaryOperator](../../../java/util/function/IntBinaryOperator.html "interface in java.util.function") op)

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

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

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

Returns an equivalent stream that is sequential.

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

[skip](../../../java/util/stream/IntStream.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.

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

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

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

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

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

Returns a spliterator for the elements of this stream.

int

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

Returns the sum of elements in this stream.

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

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

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

int[]

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

Returns an array containing the elements of this stream.