Java Program: please choose an aswer: void uknownMethod( KWLinkedList list1, E value1, E value2){Listiterator iter = list1.listlterator();int i;while (iter.hasNext()){if...



Java Program:


please choose an aswer:


Assume that the following is a method in class LinkedListExample and class KWLinkedList as explained in the lectures is<br>available for use. What does the following non-member method do?<br>public static<E> void uknownMethod( KWLinkedList<E> list1, E value1, E value2)<br>{<br>Listiterator<E> iter = list1.listlterator();<br>int i;<br>while (iter.hasNext())<br>{<br>if (iter.next().equals(value1))<br>i iter.nextindex();<br>list1.add(i-1, value2):<br>}<br>}<br>A If value1 exists in list1, then it adds value2 before value1 in list1.<br>B If value1 exists in list1, then it adds value2 after value1 in list1.<br>If value1 exists in list1, then it adds value2 after one node from value1 in list1.<br>(D If value1 exists in list1, then it adds value2 before one node from value1 in list1.<br>

Extracted text: Assume that the following is a method in class LinkedListExample and class KWLinkedList as explained in the lectures is available for use. What does the following non-member method do? public static void uknownMethod( KWLinkedList list1, E value1, E value2) { Listiterator iter = list1.listlterator(); int i; while (iter.hasNext()) { if (iter.next().equals(value1)) i iter.nextindex(); list1.add(i-1, value2): } } A If value1 exists in list1, then it adds value2 before value1 in list1. B If value1 exists in list1, then it adds value2 after value1 in list1. If value1 exists in list1, then it adds value2 after one node from value1 in list1. (D If value1 exists in list1, then it adds value2 before one node from value1 in list1.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here