private static void walkInfix(int precedence,ExpressionTree expression,List<ExpressionTree> operands,List<String> operators){
  if (expression instanceof BinaryTree) {
    BinaryTree binaryTree=(BinaryTree)expression;
    if (precedence(binaryTree) == precedence) {
      walkInfix(precedence,binaryTree.getLeftOperand(),operands,operators);
      operators.add(operatorName(expression));
      walkInfix(precedence,binaryTree.getRightOperand(),operands,operators);
    }
 else {
      operands.add(expression);
    }
  }
 else {
    operands.add(expression);
  }
}

private static void walkInfix ( int precedence , ExpressionTree expression , List < ExpressionTree > operands , List < String > operators ) { if ( expression instanceof BinaryTree ) { BinaryTree binaryTree = ( BinaryTree ) expression ; if ( precedence ( binaryTree ) == precedence ) { walkInfix ( precedence , binaryTree . getLeftOperand ( ) , operands , operators ) ; operators . add ( operatorName ( expression ) ) ; walkInfix ( precedence , binaryTree . getRightOperand ( ) , operands , operators ) ; } else { operands . add ( expression ) ; } } else { operands . add ( expression ) ; } }
accumulate the operands and operators .
