How to initialize a Scala immutable hashmap with values?

Do you mean something like this?


scala> val m = collection.immutable.HashMap(0 -> 1, 2 -> 3)
m: scala.collection.immutable.HashMap[Int,Int] = Map((0,1), (2,3))

scala> m.get(0)
res0: Option[Int] = Some(1)

scala> m.get(2)
res1: Option[Int] = Some(3)

scala> m.get(1)
res2: Option[Int] = None

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)