Java 双链表队列

public class FirstLastListQueue {
	private  FirstLastList fll = new FirstLastList();

	public void push(Object obj){
		fll.insertLast(obj);
	}
	
	public Object pop() throws Exception{
		return fll.deleteFirst();
	}
	
	public void display(){
		fll.display();
	}
	
	public static void main(String[] args) throws Exception{
		FirstLastListQueue fllq = new FirstLastListQueue();
		fllq.push(1);
		fllq.push(2);
		fllq.push(3);
		fllq.display();
		System.out.println(fllq.pop());
		fllq.display();
		fllq.push(4);
		fllq.display();
	}
}

  

posted on 2015-08-14 09:34  从头开始  阅读(122)  评论(0编辑  收藏  举报