T
- The type of data item in the streampublic abstract class AbstractStream<T> extends Object implements Stream<T>
Constructor and Description |
---|
AbstractStream() |
Modifier and Type | Method and Description |
---|---|
Stream<T> |
filter(Predicate<T> filter)
Transform the stream by creating a view that consists of only the items
that match the given
Predicate . |
void |
forEach(Operation<T> op)
Apply the given
Operation to each item in the stream. |
int |
forEach(Operation<T> operation,
int limit)
Apply the given
Operation to each item in the stream. |
void |
forEach(Operation<T> operation,
Predicate<T> stopPredicate)
Apply the given
Operation to each item in the stream. |
Iterator<T> |
iterator() |
<R> Stream<R> |
map(Function<T,R> mapper)
Transform the stream by creating a new stream that transforms the items
in this stream with the given
Function . |
<R> Stream<R> |
map(MultiFunction<T,R> mapper)
Transform the stream by creating a new stream that transforms the items
in this stream with the given
Function . |
void |
parallelForEach(Operation<T> op)
Apply the given
Operation to each item in the stream, making use
of multiple threads. |
void |
parallelForEach(Operation<T> op,
ThreadPoolExecutor pool)
Apply the given
Operation to each item in the stream, making use
of multiple threads. |
void |
remove()
Throws an UnsupportedOperationException()
|
<R> Stream<R> |
transform(Function<Stream<T>,Stream<R>> transform)
Transform the stream using the given function to transform the items in
this stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, hasNext, next
forEach, spliterator
public AbstractStream()
public void forEach(Operation<T> operation, Predicate<T> stopPredicate)
Stream
Operation
to each item in the stream. Items are
presented to the Operation
in the order they appear in the
stream. The given Predicate
can be used to stop processing of the
stream once some condition is met.
Note: for an unbounded stream, this method will never return unless some form of exception is raised or the condition of the stopPredicate is met.
public int forEach(Operation<T> operation, int limit)
Stream
Operation
to each item in the stream. Items are
presented to the Operation
in the order they appear in the
stream. The given Predicate
can be used to stop processing of the
stream once some condition is met.
Note: for an unbounded stream, this method will never return unless some form of exception is raised or the condition of the stopPredicate is met.
public void parallelForEach(Operation<T> op)
Stream
Operation
to each item in the stream, making use
of multiple threads. The order in which operations are performed on the
stream is not guaranteed.
This method is intended to be a shortcut to calling
Parallel.forEachUnpartitioned(Iterator, Operation)
.
Note: for an unbounded stream, this method will never return unless some form of exception is raised.
parallelForEach
in interface Stream<T>
op
- the Operation
to applypublic void parallelForEach(Operation<T> op, ThreadPoolExecutor pool)
Stream
Operation
to each item in the stream, making use
of multiple threads. The order in which operations are performed on the
stream is not guaranteed.
This method is intended to be a shortcut to calling
Parallel.forEachUnpartitioned(Iterator, Operation, ThreadPoolExecutor)
.
Note: for an unbounded stream, this method will never return unless some form of exception is raised.
parallelForEach
in interface Stream<T>
op
- the Operation
to applypool
- the thread pool.public Stream<T> filter(Predicate<T> filter)
Stream
Predicate
.public <R> Stream<R> transform(Function<Stream<T>,Stream<R>> transform)
Stream
public <R> Stream<R> map(Function<T,R> mapper)
Stream
Function
.public <R> Stream<R> map(MultiFunction<T,R> mapper)
Stream
Function
.public void remove()