![]() |
VOOZH | about |
Map size() method in Java is used to get the total number entries i.e, key-value pair. So this method is useful when you want total entries present on the map. If the map contains more than Integer.MAX_VALUE elements returnInteger.MAX_VALUE
Syntax:
int size();
Parameter: This method does not take any parameter.
Return value: This method returns the number of key-value mappings in this map.
Example 1: For non-generic input
Output:
Size of the map is : 4
Example 2: For Generic Input
Output:
Size of the map is : 4