Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created July 9, 2018 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajjadyousefnia/94f68f66cddd946842f92519b2c6b05d to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/94f68f66cddd946842f92519b2c6b05d to your computer and use it in GitHub Desktop.
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