<@U0B8ZP13Q> I use a similar function for converti...
# announcements
r
@cedric I use a similar function for converting to to JavaFX `TreeItem`s:
Copy code
fun <T, U> List<T>.toTree(children: (T) -> List<T>, convert: (T) -> TreeItem<U>): List<TreeItem<U>> {
    return map { convert(it).apply { this.children.setAll(children(it).toTree(children, convert)) } }
}
It would be pretty simple to adapt to any Tree structure though.