Hi elise,
To get an iterator for a Collection, you use the iterator method. You can then step through the objects in the Collection as required.
If the objects in the Linked List are Linked Lists, you can recursively pass them back to the method...
import java.util.LinkedList;
import java.util.Iterator;
...
public void recurseALinkedList(LinkedList list) {
Iterator iter = list.iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof LinkedList) {
recurseALinkedList((LinkedList) o);
} else {
// print the object
}
}
}
Hope this helps,
scrat