Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

(def n (count mymap))
auto n = mymap.size();
n = mymap.Count;
const n = mymap.length;
n := len(mymap)
def n = mymap.size()
import qualified Data.Map as Map
getMapSize :: Map.Map k v -> Int
getMapSize m = Map.size m
const length = map.size
int n = mymap.size();
local n=0
for _ in pairs(mymap) do n=n+1 end
$n = count($mymap);
fgl
n := MyMap.Count;
my $n = keys %mymap;
n = len(mymap)
n = mymap.size
let n = mymap.len();
val n = mymap.size
n := mymap size.

New implementation...
programming-idioms.org