Provide details on what you need help with along with a budget and time limit. Questions are posted anonymously and can be made 100% private.
Match with a Tutor
Studypool matches you to the best tutor to help you with your question. Our tutors are highly qualified and vetted.
Get Quality Help
Your matched tutor provides personalized help according to your question details. Payment is made only after you have completed your 1-on-1 session and are satisfied with your session.
P ROBLEM
Using the given generic interface LinkedList.java and the generic class Node.java, create a class MyLinkedList.java which is a
generic class which implements LinkedList.java. It should contain the following attributes:
•
Node head – the first value of the linked list
As well as the following constructors/methods:
•
•
add(E item): void – Adds a new Node containing the item E to the end of the linked list.
add(E item, int loc): void – Adds a new Node containing the item E at the location loc, shifting the item already there
forward if necessary.
•
remove(E item): void – removes the first node containing a value equal to item, adjusting the order the linked list
traverses if necessary.
•
•
•
•
clear(): void – Empties the linked list entirely.
getSize(): int – returns the size of the list by traversing through the linked list.
getValue(int loc): E – returns the value of the node located at index loc.
indexOf(E item): int – returns the index of the first node that contains the value item.
rev. February 16 – 1 / 1
Purchase answer to see full
attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Would you like to help your fellow students? Are you in need of an additional source of income? Apply to become a tutor on Studypool! Our best tutors earn over $7,500 each month!