Is there a concise way to pattern match on a value and check if it is a member of multiple collections? I would like to write this, but itโs not valid syntax. (Adding the lists together would make sense in this example, but not in the real code).
Copy code
when (someValue) {
in list1 && in list2 -> TODO()
}
Or do I have to write it like this?
Copy code
when {
someValue in list1 && someValue in list2 -> TODO()
}
๐ค 1
CJ Lindblad
08/26/2022, 8:02 PM
For clarity, the real code has lots of cases where it checks membership in a bunch of collections.