Created
March 16, 2021 04:48
-
-
Save bijukunjummen/a6d419835c0aa17e2f68367b1c03947f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class Try<out T> { | |
abstract fun isSuccess(): Boolean | |
fun isFailure(): Boolean = !isSuccess() | |
class Success<T>(private val result: T) : Try<T>() { | |
override fun isSuccess(): Boolean = true | |
} | |
class Failure<T>(private val throwable: Throwable) : Try<T>() { | |
override fun isSuccess(): Boolean = false | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment