Logo

Programming-Idioms

# 170 Get map size
Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
(def n (count mymap))
auto n = mymap.size();
n = mymap.Count;
const n = mymap.length;
var 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 n = mymap.size
int n = mymap.size();
local n=0
for _ in pairs(mymap) do n=n+1 end
$n = count($mymap);
uses 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.