Question: Write a method size() that returns the number of elements in the linkedlist CupList. Write a method getNodeAt() that returns the reference to cup

Write a method size() that returns the number of elements in the linkedlist CupList.  Write a method

Write a method size() that returns the number of elements in the linkedlist CupList. Write a method getNodeAt() that returns the reference to cup node object at a specific position given as a parameter of the method. Write a method, insert Pos(), to insert a new CupNode object at a specific position given as a parameter of the method. Write a method, deletePos(), to remove the CupNode object at a specific position given as a parameter of the method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

java public int size int count 0 CupNode current head while current null count current currentnext return count This method iterates through the linked liststarting at the head nodeand increments a co... View full answer

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 Programming Questions!