Join Slack
Powered by
Hi all, How can returnList be generated in a funct...
# announcements
l
liminal
04/20/2019, 2:35 AM
Hi all, How can returnList be generated in a functional way?
Untitled.kt
g
gildor
04/20/2019, 2:44 AM
You can do this using filter for section and flatMap. But your imperative implementation has better performance than possible functional ones
l
liminal
04/20/2019, 2:52 AM
Thanks Andrey, what would flatMap part look like?
g
gildor
04/20/2019, 3:01 AM
You also can omit .toList(), depends on case, but because your mutable list is not cached, you can return it without protective copy
👍 1
Open in Slack
Previous
Next