LinkedListUtil.java
import java.util.LinkedList;
import java.util.ListIterator;
/**
This LinkedListUtil class tests various usages of the LinkedList class
param1 is an array of one or more String elements, param2 and param3 are Strings.
You will create a linked list from param1. Then you are to add param2 as a
new 2nd element and param3 as a new 2nd to last element of the linked list.
*/
public class LinkedListUtil
{
public static LinkedList<String> check(String[] values, String s1, String s2)
{
LinkedList<String> list = new LinkedList<String>();
for (String s : values)
list.addLast(s);
processList(list, s1, s2);
return list;
}
public static void processList(LinkedList<String> list, String s1, String s2)
{
// TODO: Create a list iterator
// then add a new 2nd element, s1
// TODO: mode the iterator to the end of the list
// then move it back past the last element before adding s2
}
}