right If Not Null
Deprecated
This API is considered redundant. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer Kotlin nullable syntax
Replace with
this?.right() ?: default().left()
Content copied to clipboard
Returns Right if the value of type B is not null, otherwise the specified A value wrapped into an Left.
Example:
import arrow.core.rightIfNotNull
fun main() {
"value".rightIfNotNull { "left" } // Right(b="value")
null.rightIfNotNull { "left" } // Left(a="left")
}
Content copied to clipboard