doPushPopSymbol static method

String doPushPopSymbol(
  1. List<String> stack,
  2. String symbol,
  3. String currentCh
)

Implementation

static String doPushPopSymbol(List<String> stack, String symbol, String currentCh) {
  if (empty(stack)) {
    stack.add(symbol);
  } else {
    if (top(stack, currentCh)) {
      stack.removeLast();
    } else {
      stack.add(symbol);
    }
  }
  return currentCh;
}