private static List<Category> getAllRecursive(final Iterable<Category> categories) { final List<Category> result = new ArrayList<>(); for (Category c: categories) { result.add(c); result.addAll(getAllRecursive(c.getChildren()).stream().collect(Collectors.toList())); } return result; }
private static List<Category> getAllRecursive(final Iterable<Category> categories) { final List<Category> result = new ArrayList<>(); for (Category c: categories) { result.add(c); result.addAll(getAllRecursive(c.getChildren()).stream().collect(Collectors.toList())); } return result; }
private static List<Category> getAllRecursive(final Iterable<Category> categories) { final List<Category> result = new ArrayList<>(); for (Category c: categories) { result.add(c); result.addAll(getAllRecursive(c.getChildren()).stream().collect(Collectors.toList())); } return result; }
public static CategoryTree create(final List<Category> allCategoriesAsFlatListWithoutChildrenSettings) { final List<Category> categoryTreeList = categoriesOrganizedAsTree(allCategoriesAsFlatListWithoutChildrenSettings); final List<Category> allAsFlatList = getAllRecursive(categoryTreeList); final Map<LocaleSlugPair, Category> categoriesByLocaleAndSlug = buildBySlugMap(allAsFlatList); final Map<String, Category> categoriesById = buildByIdMap(allAsFlatList); return new CategoryTreeImpl(categoryTreeList, allAsFlatList, categoriesByLocaleAndSlug, categoriesById); }
public static CategoryTree create(final List<Category> allCategoriesAsFlatListWithoutChildrenSettings) { final List<Category> categoryTreeList = categoriesOrganizedAsTree(allCategoriesAsFlatListWithoutChildrenSettings); final List<Category> allAsFlatList = getAllRecursive(categoryTreeList); final Map<LocaleSlugPair, Category> categoriesByLocaleAndSlug = buildBySlugMap(allAsFlatList); final Map<String, Category> categoriesById = buildByIdMap(allAsFlatList); return new CategoryTreeImpl(categoryTreeList, allAsFlatList, categoriesByLocaleAndSlug, categoriesById); }
public static CategoryTree create(final List<Category> allCategoriesAsFlatListWithoutChildrenSettings) { final List<Category> categoryTreeList = categoriesOrganizedAsTree(allCategoriesAsFlatListWithoutChildrenSettings); final List<Category> allAsFlatList = getAllRecursive(categoryTreeList); final Map<LocaleSlugPair, Category> categoriesByLocaleAndSlug = buildBySlugMap(allAsFlatList); final Map<String, Category> categoriesById = buildByIdMap(allAsFlatList); return new CategoryTreeImpl(categoryTreeList, allAsFlatList, categoriesByLocaleAndSlug, categoriesById); }