jdk/src/share/classes/java/util/stream/Streams.java
changeset 18825 06636235cd12
parent 18822 4b6be7c19547
child 19072 8f176099ec00
equal deleted inserted replaced
18824:9fa4af2af63d 18825:06636235cd12
   315         }
   315         }
   316     }
   316     }
   317 
   317 
   318     static final class StreamBuilderImpl<T>
   318     static final class StreamBuilderImpl<T>
   319             extends AbstractStreamBuilderImpl<T, Spliterator<T>>
   319             extends AbstractStreamBuilderImpl<T, Spliterator<T>>
   320             implements StreamBuilder<T> {
   320             implements Stream.Builder<T> {
   321         // The first element in the stream
   321         // The first element in the stream
   322         // valid if count == 1
   322         // valid if count == 1
   323         T first;
   323         T first;
   324 
   324 
   325         // The first and subsequent elements in the stream
   325         // The first and subsequent elements in the stream
   361             else {
   361             else {
   362                 throw new IllegalStateException();
   362                 throw new IllegalStateException();
   363             }
   363             }
   364         }
   364         }
   365 
   365 
   366         public StreamBuilder<T> add(T t) {
   366         public Stream.Builder<T> add(T t) {
   367             accept(t);
   367             accept(t);
   368             return this;
   368             return this;
   369         }
   369         }
   370 
   370 
   371         @Override
   371         @Override
   407         }
   407         }
   408     }
   408     }
   409 
   409 
   410     static final class IntStreamBuilderImpl
   410     static final class IntStreamBuilderImpl
   411             extends AbstractStreamBuilderImpl<Integer, Spliterator.OfInt>
   411             extends AbstractStreamBuilderImpl<Integer, Spliterator.OfInt>
   412             implements StreamBuilder.OfInt, Spliterator.OfInt {
   412             implements IntStream.Builder, Spliterator.OfInt {
   413         // The first element in the stream
   413         // The first element in the stream
   414         // valid if count == 1
   414         // valid if count == 1
   415         int first;
   415         int first;
   416 
   416 
   417         // The first and subsequent elements in the stream
   417         // The first and subsequent elements in the stream
   494         }
   494         }
   495     }
   495     }
   496 
   496 
   497     static final class LongStreamBuilderImpl
   497     static final class LongStreamBuilderImpl
   498             extends AbstractStreamBuilderImpl<Long, Spliterator.OfLong>
   498             extends AbstractStreamBuilderImpl<Long, Spliterator.OfLong>
   499             implements StreamBuilder.OfLong, Spliterator.OfLong {
   499             implements LongStream.Builder, Spliterator.OfLong {
   500         // The first element in the stream
   500         // The first element in the stream
   501         // valid if count == 1
   501         // valid if count == 1
   502         long first;
   502         long first;
   503 
   503 
   504         // The first and subsequent elements in the stream
   504         // The first and subsequent elements in the stream
   581         }
   581         }
   582     }
   582     }
   583 
   583 
   584     static final class DoubleStreamBuilderImpl
   584     static final class DoubleStreamBuilderImpl
   585             extends AbstractStreamBuilderImpl<Double, Spliterator.OfDouble>
   585             extends AbstractStreamBuilderImpl<Double, Spliterator.OfDouble>
   586             implements StreamBuilder.OfDouble, Spliterator.OfDouble {
   586             implements DoubleStream.Builder, Spliterator.OfDouble {
   587         // The first element in the stream
   587         // The first element in the stream
   588         // valid if count == 1
   588         // valid if count == 1
   589         double first;
   589         double first;
   590 
   590 
   591         // The first and subsequent elements in the stream
   591         // The first and subsequent elements in the stream