Package fj.data.fingertrees
Class Two<V,A>
java.lang.Object
fj.data.fingertrees.Digit<V,A>
fj.data.fingertrees.Two<V,A>
A two-element prefix or suffix of a finger tree.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<B> B
Folds this digit to the left using the given function and the given initial value.<B> B
Folds this digit to the right using the given function and the given initial value.int
length()
<B> B
Structural pattern matching on digits.toStream()
toString()
values()
Returns the elements of this digit as a vector.Methods inherited from class fj.data.fingertrees.Digit
init, map, measure, measured, reduceLeft, reduceRight, tail, toTree
-
Field Details
-
as
-
-
Constructor Details
-
Two
-
-
Method Details
-
foldRight
Description copied from class:Digit
Folds this digit to the right using the given function and the given initial value. -
foldLeft
Description copied from class:Digit
Folds this digit to the left using the given function and the given initial value. -
match
public <B> B match(F<One<V, A>, B> one, F<Two<V, A>, B> two, F<Three<V, A>, B> three, F<Four<V, A>, B> four) Description copied from class:Digit
Structural pattern matching on digits. Applies the function that matches the structure of this digit.- Specified by:
match
in classDigit<V,
A> - Parameters:
one
- A function to apply to this digit if it's One.two
- A function to apply to this digit if it's Two.three
- A function to apply to this digit if it's Three.four
- A function to apply to this digit if it's Four.- Returns:
- The result of applying the function matching this Digit.
-
values
Returns the elements of this digit as a vector.- Returns:
- the elements of this digit as a vector.
-
split1
-
lookup
-
length
public int length() -
toString
-
toStream
-