BaseStream (Java SE 10 & JDK 10 ) (original) (raw)


public interface BaseStream<T,S extends BaseStream<T,S>>
extends AutoCloseable
Base interface for streams, which are sequences of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using the stream types Stream and IntStream, computing the sum of the weights of the red widgets:

     int sum = widgets.stream()  
                      .filter(w -> w.getColor() == RED)  
                      .mapToInt(w -> w.getWeight())  
                      .sum();  
   

See the class documentation for Stream and the package documentation for java.util.stream for additional specification of streams, stream operations, stream pipelines, and parallelism, which governs the behavior of all stream types.
Since:
1.8
See Also:
Stream, IntStream, LongStream, DoubleStream, java.util.stream

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.