PyExpression (@NotNull Project project, @NotNull ArrayList<PyExpression> elements, @NotNull ArrayList<String> operators) { final PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); final int size = elements.size(); if (elements.isEmpty()) return null; PyExpression currentResult = elements.get(size - 1); int i = size - 2; while (i >= 0) { PyExpression nextElement = elements.get(i); String nextOperator = operators.get(i); currentResult = elementGenerator.createBinaryExpression(nextOperator, currentResult, nextElement); i--; } return currentResult; }