jdk/src/share/classes/java/util/stream/IntStream.java
changeset 18820 a87cdd6a8834
parent 18572 53b8b8c30086
child 18822 4b6be7c19547
equal deleted inserted replaced
18819:c4335fc31aeb 18820:a87cdd6a8834
   798         } else {
   798         } else {
   799             return StreamSupport.intStream(
   799             return StreamSupport.intStream(
   800                     new Streams.RangeIntSpliterator(startInclusive, endInclusive, true));
   800                     new Streams.RangeIntSpliterator(startInclusive, endInclusive, true));
   801         }
   801         }
   802     }
   802     }
       
   803 
       
   804     /**
       
   805      * Creates a lazy concatenated {@code IntStream} whose elements are all the
       
   806      * elements of a first {@code IntStream} succeeded by all the elements of the
       
   807      * second {@code IntStream}. The resulting stream is ordered if both
       
   808      * of the input streams are ordered, and parallel if either of the input
       
   809      * streams is parallel.
       
   810      *
       
   811      * @param a the first stream
       
   812      * @param b the second stream to concatenate on to end of the first stream
       
   813      * @return the concatenation of the two streams
       
   814      */
       
   815     public static IntStream concat(IntStream a, IntStream b) {
       
   816         Objects.requireNonNull(a);
       
   817         Objects.requireNonNull(b);
       
   818 
       
   819         Spliterator.OfInt split = new Streams.ConcatSpliterator.OfInt(
       
   820                 a.spliterator(), b.spliterator());
       
   821         return (a.isParallel() || b.isParallel())
       
   822                ? StreamSupport.intParallelStream(split)
       
   823                : StreamSupport.intStream(split);
       
   824     }
   803 }
   825 }