public class DuiLie {
private LinkedList link;
public DuiLie(){
link = new LinkedList();
}
public void enAdd(Object obj){
link.addLast(obj);
}
public Object enGet(){
return link.removeFirst();//先进先出
//return link.removeLast();//先进后出
}
public boolean isNull(){
return link.isEmpty();
}
} |