jdk/src/java.base/share/classes/java/util/stream/LongStream.java
changeset 32002 e378c0dc767e
parent 31644 dbca10d053fd
child 35302 e4d2275861c3
equal deleted inserted replaced
32001:cd908e480e4e 32002:e378c0dc767e
   289      * nondeterministic; it is free to take any subset of matching elements
   289      * nondeterministic; it is free to take any subset of matching elements
   290      * (which includes the empty set).
   290      * (which includes the empty set).
   291      *
   291      *
   292      * <p>Independent of whether this stream is ordered or unordered if all
   292      * <p>Independent of whether this stream is ordered or unordered if all
   293      * elements of this stream match the given predicate then this operation
   293      * elements of this stream match the given predicate then this operation
   294      * takes all elements (the result is the same is the input), or if no
   294      * takes all elements (the result is the same as the input), or if no
   295      * elements of the stream match the given predicate then no elements are
   295      * elements of the stream match the given predicate then no elements are
   296      * taken (the result is an empty stream).
   296      * taken (the result is an empty stream).
   297      *
   297      *
   298      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
   298      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
   299      * stateful intermediate operation</a>.
   299      * stateful intermediate operation</a>.
   325      * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
   325      * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
   326      *                  <a href="package-summary.html#Statelessness">stateless</a>
   326      *                  <a href="package-summary.html#Statelessness">stateless</a>
   327      *                  predicate to apply to elements to determine the longest
   327      *                  predicate to apply to elements to determine the longest
   328      *                  prefix of elements.
   328      *                  prefix of elements.
   329      * @return the new stream
   329      * @return the new stream
       
   330      * @since 1.9
   330      */
   331      */
   331     default LongStream takeWhile(LongPredicate predicate) {
   332     default LongStream takeWhile(LongPredicate predicate) {
   332         Objects.requireNonNull(predicate);
   333         Objects.requireNonNull(predicate);
   333         // Reuses the unordered spliterator, which, when encounter is present,
   334         // Reuses the unordered spliterator, which, when encounter is present,
   334         // is safe to use as long as it configured not to split
   335         // is safe to use as long as it configured not to split
   357      *
   358      *
   358      * <p>Independent of whether this stream is ordered or unordered if all
   359      * <p>Independent of whether this stream is ordered or unordered if all
   359      * elements of this stream match the given predicate then this operation
   360      * elements of this stream match the given predicate then this operation
   360      * drops all elements (the result is an empty stream), or if no elements of
   361      * drops all elements (the result is an empty stream), or if no elements of
   361      * the stream match the given predicate then no elements are dropped (the
   362      * the stream match the given predicate then no elements are dropped (the
   362      * result is the same is the input).
   363      * result is the same as the input).
   363      *
   364      *
   364      * <p>This is a <a href="package-summary.html#StreamOps">stateful
   365      * <p>This is a <a href="package-summary.html#StreamOps">stateful
   365      * intermediate operation</a>.
   366      * intermediate operation</a>.
   366      *
   367      *
   367      * @implSpec
   368      * @implSpec
   391      * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
   392      * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
   392      *                  <a href="package-summary.html#Statelessness">stateless</a>
   393      *                  <a href="package-summary.html#Statelessness">stateless</a>
   393      *                  predicate to apply to elements to determine the longest
   394      *                  predicate to apply to elements to determine the longest
   394      *                  prefix of elements.
   395      *                  prefix of elements.
   395      * @return the new stream
   396      * @return the new stream
       
   397      * @since 1.9
   396      */
   398      */
   397     default LongStream dropWhile(LongPredicate predicate) {
   399     default LongStream dropWhile(LongPredicate predicate) {
   398         Objects.requireNonNull(predicate);
   400         Objects.requireNonNull(predicate);
   399         // Reuses the unordered spliterator, which, when encounter is present,
   401         // Reuses the unordered spliterator, which, when encounter is present,
   400         // is safe to use as long as it configured not to split
   402         // is safe to use as long as it configured not to split