Lilly
04/06/2021, 12:33 AMwhen
:
destination.filterKeys { key ->
when (key) {
in list1, list2, list3 -> true
else -> false
}
}
I'm fine with this, if no one else has a more convenient solutionephemient
04/06/2021, 1:16 AMin list1, in list2, in list3 ->
right?ephemient
04/06/2021, 1:16 AMkey in list1 || key == list2 || key == list3
as you wrote itephemient
04/06/2021, 1:17 AMlistOf(list1, list2, list3).any { key in it }
would make sense. maybe not for just 3 of them, thoughLilly
04/06/2021, 1:28 AMit would be equivalent toif this is true, I made a mistake. Thanks for clarification @ephemientas you wrote itkey in list1 || key == list2 || key == list3
Vampire
04/06/2021, 7:49 AMVampire
04/06/2021, 7:51 AMlistOf(list1, list2, list3).all { key in it }
Vampire
04/06/2021, 7:52 AMlistOf
outside the lambdaephemient
04/06/2021, 7:55 AMwhen
isn't going to do the right thing regardlessephemient
04/06/2021, 7:57 AMephemient
04/06/2021, 8:01 AMcommon = list1.toSet() intersect list2 intersect list3; key in common
for exampleephemient
04/06/2021, 8:07 AMLilly
04/07/2021, 1:54 AM