L
- The type for the Left
side (not used for this class)R
- The type for the Right
sidepublic final class Right<L,R> extends Object implements Either<L,R>, Serializable
Constructor and Description |
---|
Right(R value)
Creates an instance wrapping the provide value.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
fold(java.util.function.Function<L,T> func_left,
java.util.function.Function<R,T> func_right)
Applies the provided
func_right to the wrapped value and returns the result. |
boolean |
isRight()
Always returns
true . |
Either<R,L> |
swap()
Returns a
Left containing the value for this instance. |
String |
toString()
Returns a String representation of the instance.
|
public Right(R value)
value
- The value wrapped by this instancepublic <T> T fold(java.util.function.Function<L,T> func_left, java.util.function.Function<R,T> func_right)
func_right
to the wrapped value and returns the result.fold
in interface Either<L,R>
T
- The type to return from func_left/func_right
func_left
- The function to apply in case this is a Left
func_right
- The function to apply in case this is a Right
public boolean isRight()
true
.Copyright © 2016, Peter Nerg Apache License v2.0