Write some code that will use an iterator to move the first item in an instance of StringLinkedListWithIterator (Listing 12.9) to the end of the list. For example, if the list contains "a", "b", "c", and "d", after the code runs, it will contain "b", "c", "d", and "a".

What will be an ideal response?


```
list.resetIteration();
String data = list.getDataAtCurrent();
list.deleteCurrentNode();
// Iterate to the node at the end of the list
for(int i=0; i list.goToNext();
}
list.insertNodeAfterCurrent(data);

System.out.println("First value should now be moved to the”
+ “ end of the list");
list.showList();
```

This code is in StringLinkedIteratorFragments.java.

Computer Science & Information Technology

You might also like to view...

When a local variable is declared, which of the following can be set?

a. Variable name b. Variable type c. Initial value d. All of the above e. None of these

Computer Science & Information Technology

You can customize your table by creating and applying a custom table style of your own design

Indicate whether the statement is true or false

Computer Science & Information Technology

A switch works at OSI model Layer 2

Indicate whether the statement is true or false

Computer Science & Information Technology

Boolean attributes are special because they do not require a ____ to be assigned to them.

A. type B. namespace C. structure D. value

Computer Science & Information Technology