Given the HashMap.java(put below), modify this implementation of a HashMap so th
ID: 3739798 • Letter: G
Question
Given the HashMap.java(put below), modify this implementation of a HashMap so that it becomes MediaHashMap.java. The new class will be a HashMap that uses a String id as key and media objects as values(also attached).
Once you make the MediaHashMap. Write a seperate class to test your MediaHashMap implementation, add at least 3 instances of media to the HashMap. Then remove at least one and print the remaining instances from the HashMap. Print the contents of the Hashmap, not just when added.
Media File
The my map file
Explanation / Answer
Please find the class definition of MediaHashMap.Java. MediaHashMap works only on String object as Key and Media Object as Value. Comments are provided along with the program execution output.
MediaHashMap.JAVA
================
TEST CLASS :
============
Program execution Output :
=====================
Adding 1st Element to MediaHashMap ...
Adding 2nd Element to MediaHashMap ...
Adding 3rd Element to MediaHashMap ...
Added 3 Media Object .......
MediaHashMap = [[media3, Media [idNumber=ID-Number-3, itemName=ID-Name-3, type=ID-Type-3]][media2, Media [idNumber=ID-Number-2, itemName=ID-Name-2, type=ID-Type-2]][media1, Media [idNumber=ID-Number-1, itemName=ID-Name-1, type=ID-Type-1]]]
Deleting an element from MediaHashMap .....
MediaHashMap = [[media2, Media [idNumber=ID-Number-2, itemName=ID-Name-2, type=ID-Type-2]][media1, Media [idNumber=ID-Number-1, itemName=ID-Name-1, type=ID-Type-1]]]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.