Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. fun printString(string: String) = println(string)
  2.  
  3. /**
  4. * Prints successfully
  5. */
  6. Observable.just("Test string")
  7. .doOnNext{ printString(it) }
  8. .subscribe()
  9.  
  10. /**
  11. * Prints successfully
  12. */
  13. Observable.just("Test string")
  14. .doOnNext(this::printString)
  15. .subscribe()
  16.  
  17. /**
  18. * Does not print
  19. */
  20. Observable.just("Test string")
  21. .doOnNext { this::printString }
  22. .subscribe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement