Lists, Sets, Stacks and Queues
retainAll
Write a method called retainAll that takes two sets of integers as parameters and that removes any values in the first set that are not found in the second set.
For example, given sets:
s1: [0, 19, 8, 9, 12, 13, 14, 15]
s2: [0, 19, 2, 4, 5, 9, 10, 11]
If the following call is made:
retainAll(s1, s2);
after the call, the sets would store the following values:
s1: [0, 19, 9]
s2: [0, 19, 2, 4, 5, 9, 10, 11]
You are implementing a two-argument alternative to the standard Set method called retainAll, so you are not allowed to call that method to solve this problem.
You are also not allowed to construct any structured objects to solve the problem (no set, list, stack, queue, string, etc) although you can construct iterators.
Your method should not change the second set passed as a parameter.
5 years ago
30
- Please write a brief essay (about 100 words) on Mary Harris Jones' character.
- The Electromagnetic Spectrum
- Post an explanation of how classism is demonstrated in the Hernandez video. · In your explanation, describe how power and privilege function to highlight classism in this case study. · Provide recommendations for how social workers might address
- A++ WORK
- Every quarter you close out Wayneâs books and run a quarterly comparison report package for him. This quarter, you notice...
- AWR Fun Strikes Again!
- Assignment
- Peggy now has a good grasp of agency law, but knows that she may sometimes do irresponsible things on the job. She asks you if the company would be responsible if an employee on the job injures someone on the job. What if they run someone over with the
- Think about a type of website such as a resume site, product site, or information site that you would like to create for this class. Find and compare two websites of a similar type. Review each website and pay attention to: Page layout Navigation Color a
- Submit an executive summary on the specific industry and business problem that you are going to do your research paper on. The summary should contain enough of a detailed description of the business problem that someone unfamiliar with the specific indus