/**
* @(#)Linklist.java
*
* Linklist application
*
* @author kuroro
* @version 1.00 2011/9/10
*/
import java.util.LinkedList;
public class Linklist {
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.add("NBA");
list.add("CBA");
list.add("biohazard");
list.add("violence");
list.add("biohazard");
list.add("ssdfi");
System.out.println(list);
list.add(2,"huluwa");
list.addFirst("sdf");
list.addLast("dfdsf");
System.out.println(list);
System.out.println(list.contains("huluwa"));
System.out.println(list.size());
System.out.println(list.element());
System.out.println(list.getFirst());
System.out.println(list.getLast());
System.out.println(list.pop());
System.out.println(list.pop());
System.out.println(list);
list.push("first");
System.out.println(list);
}
}
结果