Last active
May 20, 2018 19:52
-
-
Save soudmaijer/f66f5de8a2262b6c4fb83697a138f37b 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
val orderOrElse: Order = orderById?.apply { | |
// do stuff with order | |
} ?: Order() // orElse with default | |
val orderOrElseThrow: Order = orderById?.apply { | |
// do stuff with order | |
} ?: throw RuntimeException("orElseThrow") // orElseThrow | |
val orderId: Long? = orderById?.let { | |
// do stuff with order | |
it.id | |
} // Return something else than an Order |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment