13.3k views
3 votes
What is the signature of a Map method that returns the number of key-value pairs in the Map?

a) int size()
b) int count()
c) size(K key)
d) count(V value)

User Aboubacar
by
8.5k points

1 Answer

6 votes

Final answer:

The signature of a Map method that returns the number of key-value pairs in the Map is int size().

Step-by-step explanation:

The signature of a Map method that returns the number of key-value pairs in the Map is int size(). This method returns an integer that represents the number of key-value pairs in the Map. For example, if you have a Map called 'myMap' and you call the size() method on it like this: 'myMap.size()', it will return the number of key-value pairs in the Map.

User Denis Khvorostin
by
7.4k points

No related questions found