public GroupingExpression resolve() {
        if (items.size() == 1) {
            return items.remove(0).exp; // optimize common case
        }
        Deque<Item> stack = new ArrayDeque<>();
        stack.push(items.remove(0));
        while (!items.isEmpty()) {
            Item item = items.remove(0);
            while (stack.size() > 1 && stack.peek().type.pre >= item.type.pre) {
                pop(stack);
            }
            stack.push(item);
        }
        while (stack.size() > 1) {
            pop(stack);
        }
        return stack.pop().exp;
    }
Converts the internal list of operator-expression pairs into a corresponding combined grouping expression. When
this method returns there is no residue of the conversion, and this object can be reused.

@return The grouping expression corresponding to the pushed arithmetic operations.
container-search/src/main/java/com/yahoo/search/grouping/request/MathResolver.java