dictionary - How to find the number of (key , value) pairs in a map in scala? -


I need to find the number of keys (key, values) in the map of my Scala code. I repeat through the map I can get an answer and I want to know whether there is any direct task for this purpose.

you can use

  scala> Val m = map ("one" -> 1, "b" -> 2, "c" -> 3) m: scala.collection.immutable.Map [string, int] = map (a - & Gt; 1, b -> 2, c -> 3) Skeleton & gt; M.size res3: int = 3    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -