trait _Trait[A] extends Stream.Flow._extend[A] with _add[A] with _filter[A] with _flow[A] with _group[A] with _map[A] with _order[A] with _peek[A] with _zip[A] with _trigger[A]
- Alphabetic
- Stream._extend
- Stream._extend._trigger
- Stream._extend._zip
- Stream._extend._peek
- Stream._extend._order
- Stream._extend._map
- Stream._extend._group
- Stream._extend._flow
- Stream._extend._filter
- Stream._extend._add
- Stream.Flow._extend
- Stream.Flow._extend._peek
- Stream.Flow._extend._map
- Stream.Flow._extend._flow
- Stream.Flow._extend._filter
- Stream.Flow._extend.Z.Shared
- scala.AnyRef
- scala.Any
- Hide All
- Show All
- Public
- All
Method
-
def
append(element: A): ~[A]
Append
-
def
appendAll(that: ~[A]): ~[A]
Append all
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collect[B](f: PartialFunction[A, B])(implicit arg0: Tag[B]): Stream[B]
Filter and converter
Filter and converter
Only lets elements for which given PartialFinction is defined
The elements are converted to returned type
def all = ~~[Any] + "ABC" + 1 + 22.0 + "DE" + 333F + "F" all.lp // Prints ~(ABC, 1, 22.0, DE, 333.0, F) all.collect{ case s: String if (s.length > 1) => s }.lp // Prints ~(ABC, DE)
Note. collect always requires double evaluation for each element, so letMap is preferred in many cases
- Definition Classes
- _map → Shared
-
def
default(element: ⇒ A): ~[A]
Default element
-
def
drop(f: Filter[A]): Stream[A]
Reversed filter
-
def
dropAll(a: ~[A])(implicit o: Ordering[A] = null): ~[A]
Group reversed filter
Group reversed filter
Discards all elements equal to the found in that stream
val idx = (1 to 5).all.flatMap(i => Seq(i, i, i)).to[Idx] idx.all.lp // Prints: ~(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.dropAll(3 to 7).lp // Prints: ~(1, 1, 1, 2, 2, 2) idx.all.dropAll(List(2, 5, 11)).lp // Prints: ~(1, 1, 1, 3, 3, 3, 4, 4, 4)
Note. The operation is very efficient if streams are sorted
- Definition Classes
- _filter
-
def
dropAllBy[B](f: Mapping[A, B], a: ~[B])(implicit o: Ordering[B] = null): ~[A]
Property group reversed filter
Property group reversed filter
Discards elements, which produce property value equal to the found in that stream
~~("abc", "d", "e", "", "fg", "hijk").dropAllBy(_.length, Seq(0, 3)).lp // Output ~(d, e, fg, hijk)
- Definition Classes
- _filter
-
def
dropEverythingIf(b: Boolean): ~[A]
Discarding everything
Discarding everything
With a single test lets to drop the entire pipeline in favor of void instance
Note: This can also be done with 'if-else' outside the pipeline, however it proved to be useful with really long statements
(1 to 10).all.dropEverythingIf(true).lp // Prints ~()
- Definition Classes
- _filter
-
def
dropLast(number: Int): ~[A]
Sequence tail reversed filter
Sequence tail reversed filter
Discards the last consecutive number of elements
(1 to 10).all.dropLast(3).lp // Prints ~(1, 2, 3, 4, 5, 6, 7)
- Definition Classes
- _filter
-
def
dropNext(number: Int): ~[A]
Sequence head reversed filter
Sequence head reversed filter
Discards the first consecutive number of elements
(1 to 10).all.dropNext(3).lp // Prints ~(4, 5, 6, 7, 8, 9, 10)
- Definition Classes
- _filter
-
def
dropRange(r: Range): ~[A]
Sequence range reversed filter
Sequence range reversed filter
Discards elements, which fall within the specified range
(1 to 10).all.dropRange(3 to 7).lp // Prints ~(1, 2, 3, 9, 10)
- Definition Classes
- _filter
-
def
dropWhile(f: Filter[A]): ~[A]
Sequence head reversed filter
Sequence head reversed filter
Discards first consecutive elements satisfying the filter
Note, everything starting from the first non compliant element will be allowed (including later compliant elements)
def all = (1 to 5).all +~ (1 to 5) all.lp // Prints ~(1, 2, 3, 4, 5, 1, 2, 3, 4, 5) all.dropWhile(_ <= 3).lp // Prints ~(4, 5, 1, 2, 3, 4, 5)
- Definition Classes
- _filter
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
filter(f: Filter[A]): Stream[A]
Same as let
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: Mapping[A, ~[B]])(implicit i: Tag[B]): Stream[B]
Map multiplier
Map multiplier
For every existing element, a mapped stream of elements is inserted into the pipeline
Note. The mapping can return an empty stream, in which case total number of elements might even be reduced
~~(1, 2, 3).flatMap(i => Seq(i * 10, i * 100, i * 1000)).lp // Output ~(10, 100, 1000, 20, 200, 2000, 30, 300, 3000)
- f
function to provide a stream of elements for each existing element
-
def
flatten[B](implicit f: Mapping[A, ~[B]], i: Tag[B]): Stream[B]
Converts a stream of streams into a flat stream
Converts a stream of streams into a flat stream
val stream: ~[~[Char]] = ~~( 'a' to 'd', List('x', 'y', 'z'), Vector('v', 'e', 'c', 't', 'o', 'r')) stream.flatten.lp // Prints: ~(a, b, c, d, x, y, z, v, e, c, t, o, r)
- Definition Classes
- _map
-
def
group(test: (A, A) ⇒ Boolean, peekSplit: (A, Boolean) ⇒ Any = (_, _) => ()): ~[~[A]]
Group by test
Group by test
Puts elements in the same group based on a function test for every two consecutive elements
// Putting Ints into groups of 3 (0 to 20).all.group(_ / 3 == _ / 3).tp // Output --------------- ? --------------- ~(0, 1, 2) ~(3, 4, 5) ~(6, 7, 8) ~(9, 10, 11) ~(12, 13, 14) ~(15, 16, 17) ~(18, 19, 20) ---------------
- test
function for two consecutive elements. if 'false' is returned, the second tested element will start a new group
- peekSplit
function to run for each piped element. Boolean parameter indicates if the element starts a new group
- Definition Classes
- _group
-
def
group: ~[~[A]]
Simple grouping
Simple grouping
Puts consecutive elements in the same group if they are
equal
Note: Non consecutive equal elements will end up in different groups. Prior ordering might be needed
def all = ~~(1, 2, 3).flatMap(i => Seq(i, i, i)) all.lp // Prints ~(1, 1, 1, 2, 2, 2, 3, 3, 3) all.group.tp // Prints ------------ ? ------------ ~(1, 1, 1) ~(2, 2, 2) ~(3, 3, 3) ------------
- Definition Classes
- _group
-
def
groupBy(properties: Mapping[A, Any]*): ~[~[A]]
Grouping on properties
Grouping on properties
Puts consecutive elements in the same group if all the specified properties are equal
When properties change, a new group is started
('#' to '|').all.groupBy(_.isLetter, _.isDigit).tp // Output --------------------------------------------------------------------------------- ? --------------------------------------------------------------------------------- ~(#, $, %, &, ', (, ), *, +, ,, -, ., /) ~(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) ~(:, ;, <, =, >, ?, @) ~(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) ~([, \, ], ^, _, `) ~(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) ~({, |) ---------------------------------------------------------------------------------
- properties
a set of functions, each indicating an element property
- Definition Classes
- _group
-
def
groupBySize(size: Int): ~[~[A]]
Fixed size groups
Fixed size groups
Puts consecutive elements into fixed size groups
('a' to 'z').all.groupBySize(8).tp // Output ------------------------- ? ------------------------- ~(a, b, c, d, e, f, g, h) ~(i, j, k, l, m, n, o, p) ~(q, r, s, t, u, v, w, x) ~(y, z) -------------------------
- size
of groups. Cannot be less than 1.
- Definition Classes
- _group
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
insert(index: Int, element: A): ~[A]
Insert at
-
def
insertAll(index: Int, that: ~[A]): ~[A]
Insert stream at
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
let(f: Filter[A]): Stream[A]
Main filter
-
def
letAll(that: ~[A])(implicit o: Ordering[A] = null): ~[A]
Group filter
Group filter
Only lets elements equal to the found in that stream
val idx = (1 to 5).all.flatMap(i => Seq(i,i,i)).to[Idx] idx.all.lp // Prints: ~(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.letAll(3 to 7).lp // Prints: ~(3, 3, 3, 4, 4, 4, 5, 5, 5) idx.all.letAll(List(2, 5, 11)).lp // Prints: ~(2, 2, 2, 5, 5, 5)
Note. The operation is very efficient if streams are sorted
- Definition Classes
- _filter
-
def
letAllBy[B](f: Mapping[A, B], that: ~[B])(implicit o: Ordering[B] = null): ~[A]
Property group filter
Property group filter
Only lets elements, which produce property value equal to the found in that stream
~~("abc", "d", "e", "", "fg", "hijk").letAllBy(_.length, Seq(0, 1, 2)).lp // Output ~(d, e, , fg)
- Definition Classes
- _filter
-
def
letIdx(f: Filter.Idx[A], start: Int = 0): ~[A]
Indexed filter
Indexed filter
Only lets elements satisfying the filter
('a' to 'z').all.letIdx((i, v) => i >= 2 && i <= 7, 1).lp // Output ~(b, c, d, e, f, g)
- start
the starting indexing value
- Definition Classes
- _filter
-
def
letLast(number: Int): ~[A]
Sequence tail filter
Sequence tail filter
Only lets specified number of last elements
(1 to 10).all.letLast(3).lp // Prints ~(8, 9, 10)
- Definition Classes
- _filter
-
def
letMap[B](f: Mapping[A, Opt[B]])(implicit i: Tag[B]): Stream[B]
Filter and converter
Filter and converter
Only lets elements for which given function returns non empty Opt
The elements are converted to the new type
def all = "ABC" ~+ "1" + "22" + "D" + "333" + "E" all.letMap(v => if (v.length < 2) \/ else v).lp // Prints: ~(ABC, 22, 333) all.letMap({ case s if (s.length >= 2) => s case _ => \/ }).lp // Prints: ~(ABC, 22, 333)
Note: letMap is often a faster alternative to collect with PartialFunction, because it is evaluated just once for each element
- Definition Classes
- _map → Shared
-
def
letNext(number: Int): ~[A]
Sequence head filter
-
def
letRange(r: Range): ~[A]
Sequence range filter
Sequence range filter
Only lets elements within given index range
('a' to 'z').all.letRange(1 to 7).lp // Output ~(b, c, d, e, f, g, h)
- Definition Classes
- _filter
-
def
letType[B](implicit t: ClassTag[B]): Stream[B]
Filter and type converter
Filter and type converter
Only lets elements, which are instances of the given type
Note, the result is mapped to the specified type
def all = ~~[Any] + "1" + 2 + 3.0 + 4l + "5" all.lp // Prints ~(1, 2, 3.0, 4, 5) all.letType[String].lp // Prints ~(1, 5)
- Definition Classes
- _map → Shared
-
def
letWhile(f: Filter[A]): ~[A]
Sequence head filter
Sequence head filter
Only lets first consecutive elements satisfying the filter
Note, everything starting from the first non compliant element will be discarded (including later compliant elements)
def all = (1 to 5).all +~ (1 to 5) all.lp // Prints ~(1, 2, 3, 4, 5, 1, 2, 3, 4, 5) all.letWhile(_ <= 3).lp // Prints ~(1, 2, 3)
- Definition Classes
- _filter
-
def
map[B](f: Mapping[A, B])(implicit i: Tag[B]): Stream[B]
Element conversion
-
def
mapCast[B]: Stream[B]
Element cast
-
def
mapIdx[B](f: Mapping.Idx[A, B], start: Int = 0)(implicit arg0: Tag[B]): ~[B]
Indexed element conversion
Indexed element conversion
Converts every element in the pipeline with given function
('A' to 'G').all.mapIdx(_ + "=" + _, 1).lp // Prints ~(1=A, 2=B, 3=C, 4=D, 5=E, 6=F, 7=G)
- f
the conversion function which also accepts element index in the sequence
- start
the starting value of indexing
- Definition Classes
- _map
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
noindex: ~[A]
Loose indexing optimizations
Loose indexing optimizations
Many streams from indexed sources (like IndexedSeq, Array, Vector, etc) are special. They know their size and can read elements without iteration. They can optimize operations like take, dropNext, letLast, and many others
noindex
turns this privileged Streams into regular and it is needed occasionally for debugging and testing- Definition Classes
- _flow
-
def
nosize: ~[A]
Loose size information
Loose size information
Many streams return sizeOpt, knowing their current size
nosize
drops sizing information, so some optimizations will not be availableThis is primarily for testing and debgging
- Definition Classes
- _flow
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
parallel: Stream.Flow[A]
Parallel
Parallel
Returns Stream.Flow with parallel execution
Each consecutive element will be sent to a new thread for processing
(1 to 5).all.parallel.map("Value: " + _ + "\t" + Thread.currentThread.getName).peek(println).drain // Output Value: 1 ForkJoinPool.commonPool-worker-9 Value: 3 ForkJoinPool.commonPool-worker-11 Value: 2 main Value: 4 ForkJoinPool.commonPool-worker-2 Value: 5 ForkJoinPool.commonPool-worker-4
- Definition Classes
- _flow
-
def
parallelIf(boolean: Boolean): Stream.Flow[A]
Conditionally parallel
Conditionally parallel
Switches to parallel execution if boolean parameter == true
Returns Stream.Flow, which could be implemented as sequential Stream or parallel Stream.Flow
(1 to 50).all.parallelIf(true).isParallel // Returns true (1 to 50).all.parallelIf(false).isParallep // Returns false
- Definition Classes
- _flow
-
def
parallelIfOver(threshold: Int): Stream.Flow[A]
Conditionally parallel
Conditionally parallel
Switches to parallel execution if number of elements exceeds threshold
Returns Stream.Flow, which could be implemented as sequential Stream or parallel Stream.Flow
(1 to 50).all.parallelIfOver(100).isParallel // Returns false (1 to 200).all.parallelIfOver(100).isParallel // Returns true
- Definition Classes
- _flow
-
def
partition(groupFilters: Filter[A]*): ~[~[A]]
Multi-filter grouping
Multi-filter grouping
All stream elements are grouped by specified filters
Filters are applied in sequence, thus if an element is accepted into a group, it will not be evaluated by the rest of the filters
If there are elements, which are left without a group, one extra group is created
// Age groups (1 to 80).all.partition(_ <= 12, 13 to 19, _ < 30, 30 to 40, _ < 50, _ < 65).tp // Output ------------------------------------------------------------------- ? ------------------------------------------------------------------- ~(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) ~(13, 14, 15, 16, 17, 18, 19) ~(20, 21, 22, 23, 24, 25, 26, 27, 28, 29) ~(30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40) ~(41, 42, 43, 44, 45, 46, 47, 48, 49) ~(50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64) ~(65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80) -------------------------------------------------------------------
- groupFilters
a set of filters, to specify groups
- Definition Classes
- _group
-
def
peek(f: Consumer[A]): Stream[A]
Element access
-
def
peekIdx(f: Consumer.Idx[A], start: Int = 0): Stream[A]
Indexed element access
Indexed element access
Provides access to passing pipeline elements with their index in sequence
('A' to 'C').all.peekIdx((i, v) => println("Peek " + i + " = " + v), 1).count // Returns 3 // Output Peek 1 = A Peek 2 = B Peek 3 = C
- start
starting value for element indexing
-
def
preview: Stream[A] with Stream.Interface.Preview[A]
Adds preview capabilities
Adds preview capabilities
Returns Interface.Preview, which allows to pre-load and inspect elements, even before they go through Stream
- Definition Classes
- _flow
-
def
reverse: ~[A]
Reverse order
Reverse order
Re-arranges elements is reverse order
Note: this operation is not suitable for large streams
- Definition Classes
- _flow
-
def
reverseSized(size: Int): ~[A]
Reverse order in segments
Reverse order in segments
Reverses order of elements within segments of fixed size
Use Case: Predefined Shuffle
For testing it is often needed to get elements in random order. However it cannot be completely random, if we want to replicate the bug
reverseSized can shuffle elements in a predefined order, given same group size
(1 to 15).all.reverseSized(5).lp // Prints ~(5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 15, 14, 13, 12, 11)
- Definition Classes
- _flow
-
def
sequential: Stream[A]
Restores potentially parallel Flow back to Stream
If this is already a Stream, the operation is instant, returning this
Otherwise the operation is quite expensive
In many cases it is advisable to consume pipeline as Flow instead of converting to Stream
val (count, millis) = (1 to 1000).all .parallel // Switching to parallel Stream.Flow .peek(_ => Thread.sleep(1)) // Expensive operation .sequential // Back to Stream .countAndMillis println("Count = " + count + ", done in " + millis / 1000F + " secs") // Output Count = 1000, done in 0.224 secs // Note: We have 1000 elements each pausing for 1 millis. // Without parallel processing total time would be over 1 second
-
def
shuffle: ~[A]
Randomize order
Randomize order
Re-arranges elements is random order
Note: this operation requires full buffering and is not suitable for large streams
- Definition Classes
- _flow
-
def
sliding(size: Int, step: Int = 1): ~[~[A]]
Sliding group view
Sliding group view
Example: group size 3 with step 1
('a' to 'g').all.sliding(3).tp // Output ---------- ? ---------- ~(a, b, c) ~(b, c, d) ~(c, d, e) ~(d, e, f) ~(e, f, g) ----------
Example: group size 4 with step 2
('a' to 'g').all.sliding(4,2).tp // Output ------------- ? ------------- ~(a, b, c, d) ~(c, d, e, f) ~(e, f, g) -------------
- Definition Classes
- _group
-
def
sort(implicit o: Ordering[A]): ~[A]
Sort
Sort
Sorts stream elements with provided Ordering
~~(5, 1, 4, 2, 3).sort.lp // Prints ~(1, 2, 3, 4, 5)
- Definition Classes
- _order
-
def
sortBy[B, C, D](f1: Mapping[A, B], f2: Mapping[A, C], f3: Mapping[A, D])(implicit arg0: Ordering[B], arg1: Ordering[C], arg2: Ordering[D]): ~[A]
Sort by three properties
Sort by three properties
Sorts pipeline on first property, then if indeterminate on second, etc...
- Definition Classes
- _order
-
def
sortBy[B, C](f1: Mapping[A, B], f2: Mapping[A, C])(implicit arg0: Ordering[B], arg1: Ordering[C]): ~[A]
Sort by two properties
Sort by two properties
Sorts pipeline on first property, and then, if indeterminate on second
- Definition Classes
- _order
-
def
sortBy[B](f: Mapping[A, B])(implicit o: Ordering[B]): ~[A]
Sort by property
Sort by property
Sorts pipeline on element's property, which is provided by given function
~~("aaaa", "bb", "ccc", "d").sortBy(_.length).lp // Output ~(d, bb, ccc, aaaa)
- Definition Classes
- _order
-
def
sortReversed(implicit o: Ordering[A]): ~[A]
Sort reversed
Sort reversed
Reverse sorts stream elements with provided Ordering
~~(5, 1, 4, 2, 3).sort.lp // Prints ~(5, 4, 3, 2, 1)
- Definition Classes
- _order
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
transpose[B](implicit f: Mapping[A, ~[B]]): ~[~[B]]
Transpose
Transpose
Transposes matrix where rows become columns
def all: ~[~[Int]] = ~~(11 to 15, List(21, 22, 23, 24, 25), Vector(31, 32, 33, 34, 35)) all.tp all.transpose.tp // Output --------------------- ? --------------------- ~(11, 12, 13, 14, 15) ~(21, 22, 23, 24, 25) ~(31, 32, 33, 34, 35) --------------------- ------------- ? ------------- ~(11, 21, 31) ~(12, 22, 32) ~(13, 23, 33) ~(14, 24, 34) ~(15, 25, 35) -------------
- Definition Classes
- _flow
-
def
triggerEmpty(f: ⇒ Unit): ~[A]
Run for empty
-
def
triggerEvery(seconds: Double, f: (Int, Double) ⇒ Unit): ~[A]
Run on timer
Run on timer
Runs given function every specified time period in fractional seconds, while elements are being pumped
Note, it will not run even once if all elements pumped in less than the given seconds
- seconds
period to run
- f
function with cumulative element count and cumulative time in seconds as arguments
- Definition Classes
- _trigger
-
def
triggerFirst(f: ⇒ Any): ~[A]
Runs before first
Runs before first
Runs given statement when the first element pumped, but before it is passed down the pipeline
This will not run for empty pipeline
- Definition Classes
- _trigger
-
def
triggerLast(f: (Int, Double) ⇒ Unit): ~[A]
Runs after last
Runs after last
Runs given function when pumping for the next element brings nothing
This will not run for empty pipeline
- f
Function with element count and time in seconds it took to pump all elements
- Definition Classes
- _trigger
-
def
unfold(f: Mapping[~[A], A]): ~[A]
Lazy infinite stream
Lazy infinite stream
Lazily unfolds next value with a function taking all prior values
// Unfoldifg Fibonacci Sequence (0 to 1).all.unfold(_.letLast(2).sum).letNext(20).lp // Output ~(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181)
-
def
unzip[B, C](implicit f: (A) ⇒ (B, C)): (Stream[B], Stream[C])
Unzips stream in two
Unzips stream in two
val pairs = ('a' to 'g').all.zipMap(_.upper).to[Idx] pairs.all.lp // Prints ~((a,A), (b,B), (c,C), (d,D), (e,E), (f,F), (g,G)) val (left, right) = pairs.all.unzip left.all.lp // Prints ~(a, b, c, d, e, f, g) right.all.lp // Prints ~(G, F, E, D, C, B, A)
- Definition Classes
- _zip
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
zip[B](that: ~[B]): ~[(A, B)]
Zip that
Zip that
Merges this and that streams, creating Tuples for corresponding elements
If that stream runs out of elements to merge, the rest of this stream will be discarded too
(1 to 100).all.zip('A' to 'D').lp // Prints ~((1,A), (2,B), (3,C), (4,D))
- Definition Classes
- _zip
-
def
zipAll[B](that: ~[B], thisDflt: Opt[A], thatDflt: Opt[B]): ~[(A, B)]
Merge stream
Merge stream
Merges this and that streams, creating Tuples for corresponding elements
('a' to 'f').all.zip('A' to 'H', '?', '?').lp // Output ~((a,A), (b,B), (c,C), (d,D), (e,E), (f,F), (?,G), (?,H))
- that
the stream to merge with this
- thisDflt
if this Stream has fewer elements, thisDflt will be used to fill the voids. Fails if thisDflt is required, but not available
- thatDflt
if that Stream has fewer elements, thatDflt will be used to fill the voids. Fails if thatDflt is required, but not available
- Definition Classes
- _zip
-
def
zipFoldAs[B](start: B)(f: Folding.As[B, A]): Stream[(A, B)]
Merges current folding value
Merges current folding value
(1 to 7).all.zipFoldAs(0L)(_ + _).tp // "Running Total" Output -- -- ? ? -- -- 1 1 2 3 3 6 4 10 5 15 6 21 7 28
- Definition Classes
- _zip
-
def
zipIdx(start: Int): ~[(Int, A)]
Merge index
-
def
zipIdx: ~[(Int, A)]
Merge index
-
def
zipMap[B](f: Mapping[A, B]): ~[(A, B)]
Merge property
-
def
zipNext: ~[(A, Opt[A])]
Merge with next
-
def
zipPrior: ~[(Opt[A], A)]
Merge with prior
Stream Transformation Operations
All methods return a new Stream, which should be used. The original Stream, for which the method was invoked, must be discarded
Transformation are (mostly) lazy and do not request any elements to be delivered from source