Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.
Java™ Platform
Standard Ed. 8

DRAFT ea-b00
compact1, compact2, compact3
java.util.stream

Interface IntStream

    • Method Detail

      • spliterator

        Spliterator.OfInt spliterator()
        Returns a spliterator for the elements of this stream.

        This is a terminal operation.

        Returns:
        the element spliterator for this stream
      • filter

        IntStream filter(IntPredicate predicate)
        Transform this stream into one consisting of the elements that match the given IntPredicate. This is an intermediate operation.
        Parameters:
        predicate - The test criteria to apply to each element to determine if it should be included in the output
        Returns:
        the new stream
      • map

        IntStream map(IntUnaryOperator mapper)
        Transform this stream into one consisting of the result of applying the given function to the elements of this stream. This is an intermediate operation.
        Parameters:
        mapper - The function to be applied to each element
        Returns:
        the new stream
      • mapToObj

        <U> Stream<U> mapToObj(IntFunction<U> mapper)
        Transform this stream into one consisting of the result of applying the given function to the elements of this stream. This is an intermediate operation.
        Parameters:
        mapper - The function to be applied to each element
        Returns:
        the new stream
      • mapToLong

        LongStream mapToLong(IntToLongFunction mapper)
        Transform this stream into one consisting of the result of applying the given function to the elements of this stream. This is an intermediate operation.
        Parameters:
        mapper - The function to be applied to each element
        Returns:
        the new stream
      • mapToDouble

        DoubleStream mapToDouble(IntToDoubleFunction mapper)
        Transform this stream into one consisting of the result of applying the given function to the elements of this stream. This is an intermediate operation.
        Parameters:
        mapper - The function to be applied to each element
        Returns:
        the new stream
      • flatMap

        IntStream flatMap(IntFunction<? extends IntStream> mapper)
        Transform this stream into one where each element is replaced with the contents of the stream produced by applying the provided function to that element. This is an intermediate operation.
        Parameters:
        mapper - The function to be applied to each element, resulting in an IntStream of new values
        Returns:
        the new stream
        Implementation Note
        This implementation is generally less efficient than the other form of flatMap(FlatMapper.OfIntToInt), and is provided for convenience.
      • flatMap

        IntStream flatMap(FlatMapper.OfIntToInt mapper)
        Transform this stream into one where each element is replaced with zero or more transformed values, according to the transformation encoded in the provided FlatMapper.OfIntToInt. This is an intermediate operation.
        Parameters:
        mapper - The FlatMapper.OfIntToInt that transforms each element into zero or more resulting values
        Returns:
        the new stream
        API Note
        A FlatMapper is like a function that received an element to transform, and a Consumer into which to deposit zero or more values corresponding to that element. For example, to map a stream of numbers to a stream of prime factors of those numbers:
             stringStream.flatMap((elt, destination) -> {
                                      for (i=2; i < elt; i++)
                                          if (elt % i == 0 && isPrime(i))
                                          destination.accept(i);
                                  })
                         ...
         
        Implementation Note
        This form of flatMap is usually less convenient to use than the flatMap(IntFunction) form, but is often considerably more efficient because it eliminates the overhead of stream construction and traversal.
      • substream

        IntStream substream(long startOffset)
      • substream

        IntStream substream(long startOffset,
                          long endOffset)
      • sequential

        IntStream sequential()
        Produces an equivalent stream that is sequential. If this stream is already sequential, may return itself.

        This is a stateful intermediate operation.

        Returns:
        a sequential stream
      • parallel

        IntStream parallel()
        Produces an equivalent stream that is parallel. If this stream is already parallel, may return itself.

        This is a stateful intermediate operation.

        Returns:
        a parallel stream
      • forEachOrdered

        void forEachOrdered(IntConsumer consumer)
      • sum

        int sum()
      • count

        long count()
      • toArray

        int[] toArray()
      • isParallel

        boolean isParallel()
        Returns whether this stream, when executed, will execute in parallel. Calling this method after invoking an intermediate or terminal stream operation method may yield unpredictable results.
        Returns:
        whether this stream will execute in parallel
Java™ Platform
Standard Ed. 8

DRAFT ea-b00

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.

DRAFT ea-b00