https://kotlinlang.org logo
Title
d

Daniel

05/30/2017, 12:09 PM
What tould be a good kotlin way to perform multiple (but same) comparisons with a object?
fun isNewTarget(touched: Draft) = touched !== sourceTouched && touched !== targetTouched
might it be possible to simplify this?
d

diesieben07

05/30/2017, 12:16 PM
ferranis: You could do
touched !in setOf(sourceTouched, targetTouched)
, but that has some overhead obviously. Not sure if you can do much better than your version.
👍 1
d

Daniel

05/30/2017, 12:17 PM
Thank you anyway! Maybe we get more ideas on this from the rest of the channel
a

andyb

05/30/2017, 1:37 PM
You could use something like: listOf(sourceTouched, targetTouched).none{ it == touched }