private static <T, G> void calculateLevel(final ItemGroup<T, G> item, final int level) {
        item.level = level;
        for (ItemGroup<T, G> child : item.groups) {
            calculateLevel(child, level + 1);
        }
    }
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