ListIterator it = ll.listIterator(); // get a new iterator for ll
it.next();
// move the iterator
it.next();
it.next();
it.add("southeast");
// add another element
System.out.println(ll);
while( it.hasNext() )
// move to end
{
it.next();
}
it.previous();
// move back
it.previous();
it.add("southwest");
// add another element
System.out.println(ll);
additional output:
[north, northeast, east,
southeast, south, west, northwest]
[north, northeast, east,
southeast, south, southwest, west, northwest]