BaseStream
Description
BaseStream interface defines all methods common to all types of streams.
- Iterator<T> iterator()
terminal operation
returns an iterator for the stream. - sequential()
intermediate operation
returns a sequential stream. If the stream is already sequential, it returns itself. It converts a parallel stream into a sequential stream. - parallel()
intermediate operation
returns a parallel stream. If the stream is already parallel, it returns itself. It convert a parallel stream into a sequential stream. - boolean isParallel()
returns true if the stream is parallel, false otherwise.
Calling this method after invoking an terminal stream operation method may yield unpredictable results. - unordered()
intermediate operation
returns an unordered version of the stream. If the stream is already unordered, it returns itself.