private static <T, G> void pruneTree(final ItemGroup<T, G> item, final Comparator<Object> comp, final Predicate<ItemGroup<T, G>> predicate) {
        //child-first
        for (ItemGroup<T, G> child : new LinkedList<>(item.groups)) {
            pruneTree(child, comp, predicate);
        }
        if (predicate != null && !predicate.test(item)) {
            prune(item, comp);
        }
    }
Creates a new tree of grouped items and returns it

@param items items to group
@param groupMapper function to map an item to a group
@param groupGroupMapper function to map groups to other groups (thus creating a tree)
@param itemOrder function to order groups and items within each other
@param pruner checker for created groups if the group should be pruned from the tree
@return root of grouped tree
main/src/main/java/cgeo/geocaching/utils/ItemGroup.java