Code example for Stack

Methods: isEmpty, pop

0
		redostates.clear(); 
//... 
    } 
	 
    public void undo() { 
        if(!undostates.isEmpty()) 
        { 
            redostates.push( currentstate.createMemento() ); 
            currentstate.setMemento( undostates.pop() ); 
        } 
    } 
	 
    public void redo() { 
		if(!redostates.isEmpty()) 
		{ 
			undostates.push( currentstate.createMemento() ); 
			currentstate.setMemento( redostates.pop() ); 
		} 
    } 
//... 
}