A:添加功能
void addFirst(Object e)
void addLast(Object e)
B:获取功能
Object getFirst()
Object getLast()
C:删除功能
Object removeFirst()
Object removeLast()
public class LinkedListDemo {
public static void main(String[] args) {
LinkedList link = new LinkedList();
link.add("hello");
link.add("world");
link.add("java");
// 添加功能
// link.addFirst("EE");
// link.addLast("ME");
// 获取功能
// System.out.println("getFirst:"+link.getFirst());
// System.out.println("getLast:"+link.getLast());
// 删除功能
System.out.println("removeFirst:" + link.removeFirst());
System.out.println("removeLast:" + link.removeLast());
System.out.println("link:" + link);
}
}
|
|