Package javascalautils
Class Left<L,R>
- java.lang.Object
-
- javascalautils.Left<L,R>
-
- Type Parameters:
L
- The type for theLeft
sideR
- The type for theRight
side (not used for this class)
- All Implemented Interfaces:
java.io.Serializable
,Either<L,R>
public final class Left<L,R> extends java.lang.Object implements Either<L,R>, java.io.Serializable
- Since:
- 1.1
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
fold(java.util.function.Function<L,T> func_left, java.util.function.Function<R,T> func_right)
Applies the providedfunc_left
to the wrapped value and returns the result.boolean
isRight()
Always returnsfalse
.Either<R,L>
swap()
Returns aRight
containing the value for this instance.java.lang.String
toString()
Returns a String representation of the instance.
-
-
-
Constructor Detail
-
Left
public Left(L value)
Creates an instance wrapping the provide value.- Parameters:
value
- The value wrapped by this instance- Since:
- 1.1
-
-
Method Detail
-
fold
public <T> T fold(java.util.function.Function<L,T> func_left, java.util.function.Function<R,T> func_right)
Applies the providedfunc_left
to the wrapped value and returns the result.- Specified by:
fold
in interfaceEither<L,R>
- Type Parameters:
T
- The type to return fromfunc_left/func_right
- Parameters:
func_left
- The function to apply in case this is aLeft
func_right
- The function to apply in case this is aRight
- Returns:
- The result from applying either func_left or func_right
- Since:
- 1.1
-
isRight
public boolean isRight()
Always returnsfalse
.
-
toString
public java.lang.String toString()
Returns a String representation of the instance.- Overrides:
toString
in classjava.lang.Object
- Since:
- 1.1
-
-