Class Either.Right<L,R>
java.lang.Object
cloud.opencode.base.functional.monad.Either.Right<L,R>
- Type Parameters:
L- left type - 左类型R- right type - 右类型
- All Implemented Interfaces:
Either<L,R>
Right - Represents the right case (typically success)
Right - 表示右情况(通常为成功)
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface Either
Either.Left<L,R>, Either.Right<L, R> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<L2,R2> Either <L2, R2> Transform both sides 转换两侧的值booleanTransform the Right value to another Either 将 Right 值转换为另一个 Either<T> TFold both cases to a single result 将两种情况折叠为单一结果getLeft()Get the Left value if present 获取 Left 值(如果存在)Get Right value or default if Left 获取 Right 值或默认值(如果是 Left)getRight()Get the Right value if present 获取 Right 值(如果存在)inthashCode()booleanisLeft()Check if this is a Left 检查是否为 LeftbooleanisRight()Check if this is a Right 检查是否为 RightTransform the Right value 转换 Right 值Transform the Left value 转换 Left 值Return this or other Either if Left 返回本 Either 或其他 Either(如果是 Left)Execute action on Right value 对 Right 值执行操作Execute action on Left value 对 Left 值执行操作swap()Swap Left and Right 交换 Left 和 RighttoString()toTry()Convert to Try: Right becomes Success, Left becomes Failure.value()Get the right value 获取右值Methods inherited from interface Either
contains, exists, filterOrElse, forAll, stream, toOption, toValidation
-
Constructor Details
-
Right
-
-
Method Details
-
value
-
isLeft
-
isRight
-
getLeft
-
getRight
-
map
Description copied from interface:EitherTransform the Right value 转换 Right 值 -
flatMap
Description copied from interface:EitherTransform the Right value to another Either 将 Right 值转换为另一个 Either -
mapLeft
Description copied from interface:EitherTransform the Left value 转换 Left 值 -
bimap
-
getOrElse
-
orElse
-
fold
-
swap
-
peek
-
peekLeft
-
toTry
Description copied from interface:EitherConvert to Try: Right becomes Success, Left becomes Failure. 转换为 Try:Right 变为 Success,Left 变为 Failure。For Left: if the value is a Throwable, it is used directly; otherwise an OpenFunctionalException wrapping it is created.
对于 Left:如果值是 Throwable,则直接使用; 否则创建包装它的 OpenFunctionalException。
-
equals
-
hashCode
-
toString
-