Created
July 9, 2018 09:54
-
-
Save sajjadyousefnia/fbda2c6f32208d9eabd431393ed31449 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@SinceKotlin("1.1") | |
public inline fun <T> T.also(block: (T) -> Unit): T { | |
contract { | |
callsInPlace(block, InvocationKind.EXACTLY_ONCE) | |
} | |
block(this) | |
return this | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment