LinkedList has methods called
addFirst(), addLast(), getFirst(), getLast(), removeFirst(), and removeLast().
import java.util.LinkedList;
public class MainClass {
public static void main(String[] argv) {
LinkedList list = new LinkedList();
list.addFirst("1");
list.addLast("2");
System.out.println(list);
}
}
[1, 2]
8.15.LinkedList |
| 8.15.1. | LinkedList is an implementation of linked list and double-ended queue data structures. |