Write some code that will use an iterator to interchange the items in every pair of items in an instance of StringLinkedListWithIterator in Listing 12.9. For example, if the list contains "a", "b", "c", "d", "e", and "f", after the code runs, it will contain "b", "a", "d", "c", "f", and "e". You can assume that the list contains an even number of strings.
What will be an ideal response?
```
list.resetIteration();
while(list.moreToIterate()){
String toSwitch = list.getDataAtCurrent();
list.deleteCurrentNode();
list.insertNodeAfterCurrent(toSwitch);
list.goToNext();
list.goToNext();
}
System.out.println("Every pair of strings should have their”
+ “ order swapped.");
list.showList();
```
This code is in StringLinkedIteratorFragments.java.
You might also like to view...
Case-Based Critical Thinking QuestionsCase 10-1James owns an auto parts store. He wants to insert a table into his inventory report to keep the product names, quantities, and prices of the parts organized. He asks his friend Leon for help. James is having some difficulty formatting his table. Leon tells him that he should use _____ to enter a single line of parallel text in each column, so his inventory will look professional.
A. columns B. tables C. tabs D. F2 key
The ________ function can be used to identify the interest portion for a mortgage payment
A) PMT B) IPMT C) PPMT D) FV
Which report view's primary purpose is to allow you to modify report controls while reviewing live data?
A. Report View B. Print Preview C. Layout View D. Design View
A(n) ________ includes discontinuous pulses in which the presence or absence of electronic pulses is represented by 1s and 0s.
a. ADC b. DAC c. analog signal d. digital signal