Question: Implement a Linked List class. The Linked List class should contain a Node inner class, a reference to the first node, and minimally implement the

 Implement a Linked List class. The Linked List class should contain

Implement a Linked List class. The Linked List class should contain a Node inner class, a reference to the first node, and minimally implement the following methods: * addFirst getFirst removeFirst In addition, implement an inner class that functions as an iterator for your linked list class. The iterator should minimally implement the following methods: next hasNext set add remove Implement an Exception that can be thrown when the class attempts an illegal operation. Create a program that instantiates a linked list object (from the class you just created). The program should contain statements that demonstrate the functionality of the Linked List and the iterator, using each method at least once. Make sure your program handles exceptions generated by the class properly. Finally, instantiate another linked list object, and allow the user to input an arbitrary number of integer values (for example, designate the end of input by a sentinel value). Use the iterator you developed to iterate over the values in the linked list and sum them, printing the sum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!