IterableDecorator
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Left to right fold that stops if the combination function op
returns None
Left to right fold that stops if the combination function op
returns None
Attributes
- B
the result type of the binary operator
- op
the binary operator
- z
the start value
- Returns:
the result of inserting
op
between consecutive elements of the collection, going left to right with the start valuez
on the left, and stopping when all the elements have been traversed or earlier if the operator returnsNone
Lazy left to right fold. Like foldLeft
but the combination function op
is
non-strict in its second parameter. If op(b, a)
chooses not to evaluate a
and
returns b
, this terminates the traversal early.
Lazy left to right fold. Like foldLeft
but the combination function op
is
non-strict in its second parameter. If op(b, a)
chooses not to evaluate a
and
returns b
, this terminates the traversal early.
Attributes
- B
the result type of the binary operator
- op
the binary operator
- z
the start value
- Returns:
the result of inserting
op
between consecutive elements of the collection, going left to right with the start valuez
on the left, and stopping when all the elements have been traversed or earlier ifop(b, a)
choose not to evaluatea
and returnsb
Right to left fold that can be interrupted before traversing the whole collection.
Right to left fold that can be interrupted before traversing the whole collection.
Attributes
- B
the result type
- op
the operator
- z
the start value
- Returns:
the result of applying the operator between consecutive elements of the collection, going right to left, with the start value
z
on the right. The result of the application of the functionop
to each element drives the process: if it returnsLeft(result)
, thenresult
is returned without iterating further; if it returnsRight(f)
, the functionf
is applied to the previous result to produce the new result and the fold continues.
Constructs a collection where consecutive elements are accumulated as long as the output of f for each element doesn't change.
Constructs a collection where consecutive elements are accumulated as long as the output of f for each element doesn't change.
Vector(1,2,2,3,3,3,2,2) .splitBy(identity)
produces
Vector(Vector(1), Vector(2,2), Vector(3,3,3), Vector(2,2))
Attributes
- K
the type of the computed key
- f
the function to compute a key for an element
- Returns:
a collection of collections of the consecutive elements with the same key in the original collection