SHARE
TWEET

Untitled

a guest Sep 16th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inline fun <reified T> T?.guard(block: T?.() -> Unit): T {
  2.     this?.let {
  3.         return it
  4.     } ?: run {
  5.         block()
  6.     }
  7.  
  8.     return T::class.java.newInstance()
  9. }
  10.  
  11. val context = context.guard { return }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top