import java.util.Iterator;
import java.util.LinkedList;
public class linkedlist {
public static void main(String[] args){
LinkedList list = new LinkedList();
list.add("a1");
list.add("a2");
// 添加到列表开头
list.addFirst("a3");
System.out.println(list);
// 取出并移除首元素
System.out.println("r_f:"+list.removeFirst());
Iterator it = list.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
}
}