FingerTree
- Companion
- object
class Object
trait Matchable
class Any
Value members
Methods
Returns the first (left-most) element in the tree. Throws a runtime exception if performed on an empty tree.
- Returns
-
the head element
Returns the first (left-most) element in the tree as an option.
- Returns
-
the head element (
Some
), orNone
if the tree is empty
Returns a copy of the tree with the first (head) element removed. Throws a runtime exception if performed
on an empty tree.
on an empty tree.
- Value Params
- m
-
the measure used to update the tree's structure
- Returns
-
the new tree with the first element removed
Returns the last (right-most) element in the tree. Throws a runtime exception if performed on an empty tree.
- Returns
-
the last element
Returns the last (right-most) element in the tree as an option.
- Returns
-
the last element (
Some
), orNone
if the tree is empty
Prepends an element to the tree.
- Value Params
- b
-
the element to prepend
- m
-
the measure used to update the tree's measure
- Returns
-
the new tree with the element prepended
Appends an element to the tree.
- Value Params
- b
-
the element to append
- m
-
the measure used to update the tree's structure
- Returns
-
the new tree with the element appended
Converts the tree to a
List
representation.- Returns
-
a
List
constructed from the elements in the tree
Same as
Unlike
span1
, but prepends the discerning element to the right tree, returning the left and right tree.Unlike
span1
, this is an allowed operation on an empty tree.- Value Params
- pred
-
a test function applied to the elements of the tree from left to right, until a
the test returnsfalse
.
- Returns
-
the split tree, as a
Tuple2
with the left and the right tree
Traverses the tree until a predicate on an element becomes
returning the elements before that element (the prefix for which the predicate holds),
the element itself (the first for which the predicate does not hold), and the remaining elements.
false
, and then splits the tree,returning the elements before that element (the prefix for which the predicate holds),
the element itself (the first for which the predicate does not hold), and the remaining elements.
This method is somewhat analogous to the
being that the predicate tests the tree's measure and not individual elements.
span
method in standard Scala collections, the differencebeing that the predicate tests the tree's measure and not individual elements.
Note that the returned discerning element corresponds to the last element in the tree, if
pred
returns true
for every element (rather than a runtime exception being thrown).If the tree is empty, this throws a runtime exception.
- Value Params
- pred
-
a test function applied to the elements of the tree from left to right, until a
the test returnstrue
.
- Returns
-
the split tree, as a
Tuple3
with the left tree, the discerning element, and the right tree
Traverses the tree until a predicate on an element becomes
element. Note that if
tree is returned (rather than a runtime exception being thrown).
true
, and then returns thatelement. Note that if
pred
returns false
for every element, the last element in thetree is returned (rather than a runtime exception being thrown).
If the tree is empty, this throws a runtime exception.
- Value Params
- pred
-
a test function applied to the elements of the tree from left to right, until a
the test returnstrue
.
- Returns
-
the discerning element