Last active
September 24, 2018 08:37
-
-
Save Lamartio/82e80b38eb2838bc5dd68aa6bf9ff76b to your computer and use it in GitHub Desktop.
User.kt
This file contains 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
data class User(val name: String = "Danny", val age: Int = 27) { | |
companion object { | |
fun asDataSource(): Observable<User> = | |
Observable | |
.interval(1, TimeUnit.SECONDS) | |
.scan(User()) { user, _ -> user.copy(age = user.age + 1) } | |
.observeOn(AndroidSchedulers.mainThread()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment