Created
March 16, 2021 04:50
-
-
Save bijukunjummen/e6715aca1fac9e3a7ecf321123e01c44 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 get(): T | |
class Success<T>(private val result: T) : Try<T>() { | |
... | |
override fun get(): T = result | |
} | |
class Failure<T>(private val throwable: Throwable) : Try<T>() { | |
... | |
override fun get(): T = throw throwable | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment