X1128: Maybe Add

Write a method that takes a key and an associated value as parameters, and will only add them as anew entry in the map if the key is not already present in the map--it will not overwrite existing entries. The map you will use is stored in a field within the class, as shown below. Your method should return true if an entry was added, or false if the provided key is already present in the map and so the pair was not added.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.