Collections
- Which of these method is used add an element and corresponding key to a map?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Maps revolve around two basic operations – get() and put(). to put a value into a map, use put(), specifying the key and the value. To obtain a value, call get() , passing the key as an argument. The value is returned.
- Which of these methods can be used to obtain set of all keys in a map?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
keySet() methods is used to get a set containing all the keys used in a map. This method provides set view of the keys in the invoking map.
- Which of these method Map class is used to obtain an element in the map having specified key?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
get()
- Which of these method is used to remove all keys/values pair from the invoking map?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
remove()
- Which of these classes provide implementation of map interface?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
AbstractMap, WeakHashMap, HashMap and TreeMap provide implementation of map interface.