Created
October 9, 2021 14:48
-
-
Save devrath/29110a981e20b648fe5e58edd1951edf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| private fun simpleDemo() { | |
| retrieveUserFromNetwork("111") { | |
| println(it.userName) | |
| } | |
| } | |
| private fun retrieveUserFromNetwork( | |
| userId:String, | |
| userRetrieved:(user:User) -> Unit | |
| ) { | |
| thread { | |
| Thread.sleep(1000) | |
| val user = User(userId,"TestUser") | |
| userRetrieved(user) | |
| } | |
| } | |
| data class User(val userId:String,val userName:String) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment