Ruckus
02/02/2017, 11:44 PMfun <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.