Skip to content

Instantly share code, notes, and snippets.

@jillesme

jillesme/demo.kt Secret

Created September 27, 2021 22:39
Show Gist options
  • Save jillesme/d1e1af0e0f56f8b5e02d27f9bc17afa5 to your computer and use it in GitHub Desktop.
Save jillesme/d1e1af0e0f56f8b5e02d27f9bc17afa5 to your computer and use it in GitHub Desktop.
val newX = x.copy(
a = if (fields.contain("a")) x.a else y.a
b = if (fields.contain("b")) x.b else y.b
c = if (fields.contain("c")) x.c else y.c
)
// Is there a nicer way that i could do:
val newX = x.copy(a = getCorrect("a"), b = getCorrect("b'), c = getCorrect("c"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment