logo Practice-It logo

rapperNames

Language/Type: Java Guava BiMap collections
Author: Marty Stepp (on 2013/01/22)

A company is hiring new employees, but they do not want to hire anyone who is a known rapper, because rappers are questionable characters. Write a method named rapperNames that accepts two parameters: a BiMap from people's names to their rapper nicknames, and a Set of possible interview candidates (strings). We don't want to interview the ones who are secretly rappers. You should return a new Set of which candidates the company would like to interview. If an interview candidate string is the real name or the rapper nickname of a known rapper, he/she should not be interviewed. For example, given this data:

  • rappers: {Marshall Mathers=Eminem, Shad Moss=Bowwow, Sean Combs=Diddy, Trevor Smith=Busta Rhymes, Michael Diamond=Mike D}
  • candidates: [Jim Jones, Eminem, Sean Combs, Suzy Smith, Michael Diamond, Busta Rhymes]

You would return the set [Jim Jones, Suzy Smith] to be interviewed.

Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.