Combining multiple nullable collection in Kotlin
I am working on a kotlin function that needs to combine a series of nullable collections into a single output collection. The obvious solution is brute force. Use a series of if/else statements to figure out which collections are not null and combine them accordingly. However, this solution is messy and error prone. What I’m looking for is an existing kotlin function that can take n+1 nullable collections and output a new collection with their combined contents. Does something like this exist, or do I simply have to do this the hard way?