Code example for Deque

Methods: push, removeFirst, size

0
	public UndoManager(int max){
		this.max = max;
	} 
 
	public void push(Backup uinfo){
		undoStack.push(uinfo);
		 
		if(undoStack.size() > max){
			undoStack.removeFirst();
		} 
		 
		changed = true;
	} 
 
	public Backup pop() { 
		if (undoStack.isEmpty()) {
			return null; 
		} 
		else { 
			changed = true;
		}