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

Given the following Java class fragment for an UnorderedList class, write the me

ID: 3652529 • Letter: G

Question

Given the following Java class fragment for an UnorderedList class, write the method:

public int indexOf(E data)

Your method "public int indexOf(E data)" returns the zero based position of the element data if it is in the list, and return -1 if it is not in the list.

A A B C D E F G
H 16 46 82 9 16 29 1
B C D E F G 0 (NULL)
H meaning the head of the list

if the method is list.indexOf(16) the method returns 0.
if the method is list.indexOf(82) the method returns 2.
if the method is list.indexOf(99) the method returns -1.

public class UnorderedList<E> {
//////////////////////////////////////

Explanation / Answer

public int indexOf(Object o){ for(int i = 0; i
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