Question: Most of the basic ArrayList operations: size, add, remove, get, and indexof, pare used in this problem. Generic ArrayLists (not ArrayList ) will be used

 Most of the basic ArrayList operations: size, add, remove, get, and

Most of the basic ArrayList operations: size, add, remove, get, and indexof, pare used in this problem. Generic ArrayLists (not ArrayList ) will be used in all of the exercises in this lab. It's easier, and allows more flexibility. Begin with the file TemplateLab8Bronze.java. Complete the method ArrayList extractDuplicates(ArrayList a1, ArrayList a2) which will look for elements that appear in both a1 and a2. When one is found, it should be removed from both a1 and a2. You can assume that neither list will contain duplicates. An ArrayList containing all of the elements that were removed should be returned as the result of the method. The output printed by the main method should be: a1 is [45, 12, 98, 34, 6, 42] a2 is [6, 81, 36, 12, 77, 42] removed elements: [42, 6, 12] a1 is now [45, 98, 34] a2 is now [81, 36, 77]

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!