Question: Integer setSize is read from input, followed by setSize integers that are added to HashSet ageDatabase. Then, integer eliminateAge is read from input. If eliminateAge
Integer setSize is read from input, followed by setSize integers that are added to HashSet ageDatabase. Then, integer eliminateAge is read from input. If eliminateAge exists in ageDatabase, remove eliminateAge from ageDatabase and output "Successfully eliminated". Otherwise, output "Age not encountered".
End each output with a newline.
Ex: If the input is:
then one possible output is:
Old set: Successfully eliminated New set:
Note: The order of the keys is not guaranteed in a HashMap.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
