Can i get question b a) Create a generic Map interface MyMap that represents a Map structure. K is the type for a key, V is the type of a value. A key is unique in a map and cannot be repeated. The map contains the following abstract methods. -an abstract method add(K key, V value) which adds the element to the map -an abstract method remove(K key) which removes the element with the specified key from the map and returns the value removed. -a abstract method size() which returns the size of the map -a abstract method isEmpty() that would return true if the map is empty, and false otherwise. -a abstract method keys() that returns the list of all keys. -a abstract method print() that prints all the elements of the map. b) Create a generic class MyMapImpl that implements the interface MyMap. Use an ArrayList or array to store the keys, and another ArrayList or array to store the values.
Can i get question b
a) Create a generic Map interface MyMap<K,V> that represents a Map structure. K is the type for a key, V is the type of a value. A key is unique in a map and cannot be repeated.
The map contains the following abstract methods. -an abstract method add(K key, V value) which adds the element to the map
-an abstract method remove(K key) which removes the element with the specified key from the map and returns the value removed.
-a abstract method size() which returns the size of the map
-a abstract method isEmpty() that would return true if the map is empty, and false otherwise.
-a abstract method keys() that returns the list of all keys.
-a abstract method print() that prints all the elements of the map.
b) Create a generic class MyMapImpl that implements the interface MyMap. Use an ArrayList or array to store the keys, and another ArrayList or array to store the values.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps