private static <T, G> void prune(final ItemGroup<T, G> item, final Comparator<Object> comp) {
        final ItemGroup<T, G> parent = item.parent;
        if (parent == null) {
            return;
        }
        parent.items.addAll(item.items);
        for (ItemGroup<T, G> child : item.groups) {
            child.parent = parent;
        }
        parent.groups.remove(item);
        parent.groups.addAll(item.groups);
        parent.recalculateItemsAndGroups(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