Question: Write a method called countMatches() that returns the number of nodes that have a value that is in a given array of keys. This method

Write a method called countMatches() that returns the number of nodes that have a value that is in a given array of keys. This method takes two parameters: top, which is a reference to the first Node of the singly linked list, and keys, which is a String[] containing values to search for in the list. For example, if top points to the following list: "Me "You" "Them" > "Us" "You" "Me" and keys was ["Me", "Us"), then countMatches(top, keys) would return 3. Be sure to use.equals() when comparing strings. Here is the definition of the Node class: public class Mode public String value; public Node next; Additional Requirements: . This method is not part of a larger linked list class, so you do not have access to any prebuilt methods like insert() or delete() or to an instance variable like count. . Your method must be no more than 15 lines long. . You do not need to include any imports . Your code should assume that all of the standard Core and String Util functions are available if needed Use the Par
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
