链表实现栈

public class LinkStack {

  private LinkList thisList;

  public LinkStack(){
    thisList = new LinkList();
  }

  public void push(int data){
    thisList.insertFirst(data);
  }

  public int pop(){
    return thisList.deleteFirst().data;
  }

  public boolean isEmpty(){
    return thisList.isEmpty();
  }

  public void display(){
    thisList.display();
  }

}

链表实现队列

public class LinkQueue {
  private DoubleEndedLink theList;

  public LinkQueue() {
    theList = new DoubleEndedLink();
  }

  public void insert(int data) {
    theList.insertLast(data);
  }

  public int remove() {
    return theList.deleteFirst().data;
  }

  public boolean isEmpty() {
    return theList.isEmpty();
  }

}

参考资料