Join Slack
Powered by
Hi Is there a way to intersect an unknown number ...
# announcements
j
Jgafner
07/15/2021, 7:08 PM
Hi Is there a way to intersect an unknown number of list ?
n
nschulzke
07/15/2021, 7:30 PM
Something along these lines should work (this specific code comes with no warranty :))
Copy code
lists.reduce { a, b -> a.intersect(b).toList() }
For more information on reduce:
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/reduce.html
j
Jgafner
07/16/2021, 6:34 AM
thanks
7
Views
Open in Slack
Previous
Next