Code example for Stack

Methods: isEmpty, pop, push

0
        Character c = next(true);
        if (c == null) {
            return null; 
        } 
 
        stack.push(c);
 
        return c;
    } 
 
    public void skip(int c) throws IOException {
        for (int i = 0; i < c; i++) {
            next(); 
        } 
    } 
 
    public void push(char c) throws IOException {
        stack.push(c);
    } 
 
    public Character next() throws IOException {
        return next(true); 
    } 
 
    public Character next(boolean withStack) throws IOException {
        if (withStack && !stack.isEmpty()) {
            return stack.pop();
        } 
 
        int c = reader.read();
        if (c == -1) {
            return null;