Question: java TASK: Write a public static method called removeUnwantedValues that has a parameter of type LinkedList called allValues followed by a parameter of type Set

javajava TASK: Write a public static method called removeUnwantedValues that has aparameter of type LinkedList called allValues followed by a parameter of type

TASK: Write a public static method called removeUnwantedValues that has a parameter of type LinkedList called allValues followed by a parameter of type Set Integer> called unwantedValues. It should remove all elements of allvalues that are in unwantedValues, and it should not return anything. HINT: You can assume that both allValues and unwantedValues are non-empty EXAMPLE: If we were to run the following lines of code: // add numbers to allvalues LinkedList allValues = new LinkedList(): allValues.add(1); allValues.add(2); allValues.add(3); allValues.add(1); allValues.add(2); allValues.add(3); allValues.add(1); allValues.add(2); allValues.add(3); // add numbers we want to remove HashSet Integer> unwantedValues = new HashSet0; unwantedValues.add(1); unwantedValues.add(3); // remove them and print removeUnwantedValues(allValues, unwantedValues); System.out.println(allValues); We should print the following: [2, 2, 2] Sample Input: 1 2 3 1 2 3 1 2 3 1 3 Sample Output: 2 2 2 Write a program, test using stdin stdout Time limit: 8 seconds Memory limit: 256 MB 1 // YOUR CODE HERE

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!