Using a linked list with an iterator Build a class called Li

Using a linked list with an iterator

Build a class called LinkedListRunner with a main method that instantiates a LinkedList<String>. Add the following strings to the linked list:


Build a ListIterator<String> and use it to walk sequentially through the linked list using hasNext and next, printing each string that is encountered. When you have printed all the strings in the list, use the hasPrevious and previous methods to walk backwards through the list. Along the way, examine each string and remove all the strings that begin with a vowel. When you arrive at the beginning of the list, use hasNext and next to go forward again, printing out each string that remains in the linked list.

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

----------------------------

OUTPUT:

Iterating...
aaa
bbb
ccc
ddd
eee
fff
ggg
hhh
iii
Reversing:
After removing:
bbb
ccc
ddd
fff
ggg
hhh

Using a linked list with an iterator Build a class called LinkedListRunner with a main method that instantiates a LinkedList<String>. Add the following st

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site