Package fj.data
Class Either.RightProjection<A,B>
java.lang.Object
fj.data.Either.RightProjection<A,B>
- All Implemented Interfaces:
Iterable<B>
A right projection of an either value.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFunction application on this projection's value.Binds the given function across this projection's value if it has one.either()The either value underlying this projection.booleanReturnsfalseif no value or returns the result of the application of the given function to the value.ReturnsNoneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.booleanReturnstrueif no value or returns the result of the application of the given function to the value.Execute a side-effect on this projection's value if it has one.voidforeachDoEffect(Effect1<B> f) Execute a side-effect on this projection's value if it has one.iterator()Returns an iterator for this projection.Map the given function across this projection's value if it has one.The value of this projection or the result of the given function on the opposing projection's value.The value of this projection or the given argument.The value of this projection or the given argument.Anonymous bind through this projection.toArray()Returns a single element array if this projection has a value, otherwise an empty array.Projects an immutable collection of this projection.toList()Returns a single element list if this projection has a value, otherwise an empty list.toOption()Returns this projection's value inSomeif it exists, otherwiseNone.toStream()Returns a single element stream if this projection has a value, otherwise an empty stream.traverseIO(F<B, IO<C>> f) Traverse with a function that has IO effecttraverseList(F<B, List<C>> f) Traverse with function that produces List (non-determinism).traverseOption(F<B, Option<C>> f) Traverse this right with the given function and collect the output as an option.traverseP1(F<B, P1<C>> f) Traverse this right with the given function and collect the output as a p1.traverseStream(F<B, Stream<C>> f) value()The value of this projection or fails with a specialised error message.Returns the value of this projection or fails with the given error message.Returns the value of this projection or fails with the given error message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
e
-
-
Constructor Details
-
RightProjection
-
-
Method Details
-
iterator
Returns an iterator for this projection. This method exists to permit the use in afor-each loop. -
either
The either value underlying this projection.- Returns:
- The either value underlying this projection.
-
valueE
Returns the value of this projection or fails with the given error message.- Parameters:
err- The error message to fail with.- Returns:
- The value of this projection
-
valueE
Returns the value of this projection or fails with the given error message.- Parameters:
err- The error message to fail with.- Returns:
- The value of this projection
-
value
The value of this projection or fails with a specialised error message.- Returns:
- The value of this projection.
-
orValue
The value of this projection or the given argument.- Parameters:
a- The value to return if this projection has no value.- Returns:
- The value of this projection or the given argument.
-
orValue
The value of this projection or the given argument.- Parameters:
b- The value to return if this projection has no value.- Returns:
- The value of this projection or the given argument.
-
on
The value of this projection or the result of the given function on the opposing projection's value.- Parameters:
f- The function to execute if this projection has no value.- Returns:
- The value of this projection or the result of the given function on the opposing projection's value.
-
foreach
Execute a side-effect on this projection's value if it has one.- Parameters:
f- The side-effect to execute.- Returns:
- The unit value.
-
foreachDoEffect
Execute a side-effect on this projection's value if it has one.- Parameters:
f- The side-effect to execute.
-
map
Map the given function across this projection's value if it has one.- Parameters:
f- The function to map across this projection.- Returns:
- A new either value after mapping.
-
bind
Binds the given function across this projection's value if it has one.- Parameters:
f- The function to bind across this projection.- Returns:
- A new either value after binding.
-
sequence
Anonymous bind through this projection.- Parameters:
e- The value to bind with.- Returns:
- An either after binding through this projection.
-
traverseList
Traverse with function that produces List (non-determinism).- Parameters:
f- the function to traverse with- Returns:
- An either after traversing through this projection.
-
traverseIO
Traverse with a function that has IO effect- Parameters:
f- the function to traverse with- Returns:
- An either after traversing through this projection.
-
traverseP1
Traverse this right with the given function and collect the output as a p1.- Type Parameters:
C- the type of the p1 value- Parameters:
f- the given function- Returns:
- the p1
-
traverseOption
Traverse this right with the given function and collect the output as an option.- Type Parameters:
C- the type of the option value- Parameters:
f- the given function- Returns:
- the option
-
filter
ReturnsNoneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.- Parameters:
f- The predicate function to test on this projection's value.- Returns:
Noneif this projection has no value or if the given predicatepdoes not hold for the value, otherwise, returns a left inSome.
-
apply
Function application on this projection's value.- Parameters:
e- The either of the function to apply on this projection's value.- Returns:
- The result of function application within either.
-
forall
Returnstrueif no value or returns the result of the application of the given function to the value.- Parameters:
f- The predicate function to test on this projection's value.- Returns:
trueif no value or returns the result of the application of the given function to the value.
-
exists
Returnsfalseif no value or returns the result of the application of the given function to the value.- Parameters:
f- The predicate function to test on this projection's value.- Returns:
falseif no value or returns the result of the application of the given function to the value.
-
toList
Returns a single element list if this projection has a value, otherwise an empty list.- Returns:
- A single element list if this projection has a value, otherwise an empty list.
-
toOption
Returns this projection's value inSomeif it exists, otherwiseNone.- Returns:
- This projection's value in
Someif it exists, otherwiseNone.
-
toArray
Returns a single element array if this projection has a value, otherwise an empty array.- Returns:
- A single element array if this projection has a value, otherwise an empty array.
-
toStream
Returns a single element stream if this projection has a value, otherwise an empty stream.- Returns:
- A single element stream if this projection has a value, otherwise an empty stream.
-
toCollection
Projects an immutable collection of this projection.- Returns:
- An immutable collection of this projection.
-
traverseStream
-