SHARE
TWEET

Untitled

a guest Jun 25th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun <T1: Any, T2: Any, R: Any> lets(first: T1?, second: T2?, block: (T1, T2)-> R?): R? {
  2.     return if (first != null && second != null) block(first, second) else null
  3. }
  4.  
  5. fun <T1: Any, T2: Any, T3: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, block: (T1, T2, T3)-> R?): R? {
  6.     return if (first != null && second != null && third != null) block(first, second, third) else null
  7. }
  8.  
  9. fun <T1: Any, T2: Any, T3: Any, T4: Any, R: Any> lets(first: T1?, second: T2?, third: T3?, fourth: T4?, block: (T1, T2, T3, T4)-> R?): R? {
  10.     return if (first != null && second != null && third != null && fourth != null) block(first, second, third, fourth) else null
  11. }
  12.  
  13. lets(userLoginForm.email, userLoginForm.password) { email, password ->
  14.   // email and password guaranteed to not be null
  15. }
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