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

Java Programming: Complete the following method that is passed a String and a ch

ID: 3667318 • Letter: J

Question

Java Programming:

Complete the following method that is passed a String and a chain of nodes containing Strings. The method removes all occurrences of the target String in the chain of nodes and returns a count of how many times that target String was removed.

Be careful to handle boundary cases, e.g., when the first node and/or last node have Strings that match the target as well as when the chain is empty (has only the header node) or has only one node containing an item. You may assume the following:

-The Listnode<E> class is as described in the readings/lectures.

-The Strings can be compared with the equals method.

-The Strings in the chain are guaranteed not to be null.

-The chain is guaranteed to be a correctly formed singly-linked chain of nodes with the next field of the last node set to null.

- A header node is used by the chain of nodes.

Explanation / Answer

As Listnode<E> structure is not given in the question, I've made an assumption for the same as given below :

Please find the required method below as aligned with respect to above given class Listnode<E>, if there is any change in datafields of Listnode class, please do the required changes in the method also. Only name chages required I guess :

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