Logo

Programming-Idioms

History of Idiom 170 > diff from v5 to v6

Edit summary for version 6 by programming-idioms.org:
New Java implementation by user [programming-idioms.org]

Version 5

2018-04-08, 19:45:52

Version 6

2018-04-08, 20:10:15

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

Code
int n = mymap.size();
Doc URL
https://docs.oracle.com/javase/7/docs/api/java/util/Map.html#size()