import java.util.*;
// contains LinkedList class
class TestListIterator
{
public static void
main(String arg[])
{
LinkedList ll = new LinkedList(); // create a LinkedList
ll.add("north");
// add some elements
ll.add("east");
ll.add("south");
ll.add("west");
System.out.println(ll);
ll.add(1, "northeast");
// add at position 1 of ll
ll.addLast("northwest");
System.out.println(ll);
output so far:
[north, east, south,
west]
[north, northeast, east,
south, west, northwest]