Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Last active December 24, 2020 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilShreyas/92eb2bc1b79f36701794862368254538 to your computer and use it in GitHub Desktop.
Save PatilShreyas/92eb2bc1b79f36701794862368254538 to your computer and use it in GitHub Desktop.
fun getUser(): User {
val user = User()
- user.isAdmin = true
- user.firstName = "John"
- user.lastName = "Doe"
- user.roles = listOf("Role1", "Role2")
- return user
+ return user.apply {
+ isAdmin = true
+ firstName = "John"
+ lastName = "Doe"
+ roles = listOf("Role1", "Role2")
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment