Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program using LinkedList and ListIterator to obtain the following statem

ID: 3685889 • Letter: W

Question

Write a program using LinkedList and ListIterator to obtain the following statements:

1. Create a linked list named "number" with these elements: "one", "four" and "three".

2. Create a List Iterator named "it1" related to "number".

3. Add the new element "two" after the element "one"

4. Remove the element "four"

5. Create a new List Iterator named "it2" related to "number", to add new elements in the respective positions. To create each new element you must use the value of the current element concatenated to " and a half".

The new obtained list is:

one

one and a half two

two and a half

three

three and a half

Explanation / Answer

public class TestCollection7{
public static void main(String args[]){
LinkedList<String> number=new LinkedList<String>();
number.add("one");
number.add("four");
number.add("Three");
ListIterator<String> it2=al.listIterator();

while(itr.hasNext()){
number.add("and half")
System.out.println(it2.next());   
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote