public static List < Category > flattenCategories ( List < Category > categoryLst ) { if ( categoryLst == null ) { return null ; } List < Category > flatCategoryLst = new ArrayList <> ( ) ; flattenCategories ( flatCategoryLst , categoryLst ) ; return flatCategoryLst ; }
Puts all categories and their respective children recursively flattened into a list .