【数据结构】LinkedList
package Java02.jinjie.shujujiegou;
import java.util.LinkedList;
public class LinkedList01 {
public static void main(String[] args) {
show01();
}
private static void show01() {
LinkedList<String> linked = new LinkedList<>();
linked.add("a");
linked.add("b");
linked.add("c");
linked.addFirst("sunjiangdong");
System.out.println(linked);
linked.addLast("last");
System.out.println(linked);
System.out.println("=================");
if(!linked.isEmpty()){
String first = linked.getFirst();
System.out.println(first);
String last = linked.getLast();
System.out.println(last);
}
System.out.println("=====================");
String s = linked.removeFirst();
System.out.println(s);
String s1 = linked.removeLast();
System.out.println(s1);
System.out.println(linked);
}
}