https://kotlinlang.org logo
#announcements
Title
# announcements
f

forcelain

06/08/2017, 4:52 PM
I have an
Item
.
Item
has a list of another
Item
. Is there a way to recursively collect all subitems for a given item into a flat list?
d

diesieben07

06/08/2017, 4:54 PM
forcelain:
item.list.flatMap { it.list }
f

forcelain

06/08/2017, 4:54 PM
Thanks, I will try
k

kevinmost

06/08/2017, 5:07 PM
is that going to recurse? It looks like it only goes a layer deep
d

diesieben07

06/08/2017, 8:08 PM
True, I missed that. You could easily add that with a method in Item