This language bar is your friend. Select your favorite languages!

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

$n = count($mymap);
const n = mymap.length;
n := len(mymap)
int n = mymap.size();
n = len(mymap)
n = mymap.size
let n = mymap.len();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org

Related idioms