作者: 霍永刚 时间: 2012-9-22 06:19
public class Test {
private LinkedList<String> queue = new LinkedList<String>() ;
public void fallIn(String s){
System.out.println(s + "入队");
queue.add(s) ;
}
public void fallOut(){
int len = queue.size() ;
for(int i=0;i<len;i++){
System.out.println( queue.removeFirst() + "出队");
}
}
public void print(){
System.out.print("元素有:") ;
for(String list : queue){
System.out.print(list + " ");
}
}