_process
Def
Pump stream out
Pump stream out
Fetches and discards all stream elements
This operation can be usefull for side effects built into streaming pipeline
('A' <> 'C').stream.peek(_.tp).drain
// Output
A
B
C
- Source
- _process.scala
Process stream
Process stream
Applies given function to each stream element
('A' <> 'C').stream.foreach(_.tp)
// Output
A
B
C
- Source
- _process.scala
Heavy process stream
Heavy process stream
Applies given function to each stream element
FOREACH is functionally equivalent to foreach, but is fully inlined. It makes compiled code larger, but guarantees the best possible performance on large streams.
- Source
- _process.scala
For each indexed
For each indexed
Calls given function with counter
('A' <> 'C').stream.foreachIndexed((i,v) => "Element " + i + " = " + v tp(), 1)
// Output
Element 1 = A
Element 2 = B
Element 3 = C
- Value Params
- start
starting value for indexing
- Source
- _process.scala
Run for nonexistent value
Run for nonexistent value
Runs given function only if stream is empty.
This operation is rarely useful and is provided for consistency.
Use peekEmpty instead, it can be combined with other processing
- Source
- _process.scala
Process elements or empty case
Process elements or empty case
Applies given function to each stream element or runs second function when stream is empty
('A' <>> 'A').stream.process(_.tp, "Empty".tp)
// Output
Empty
- Source
- _process.scala