How to create map in Scala

1 Answer

0 votes
object MyClass {
    def main(args: Array[String]): Unit = {
        val mp = Map("scala" -> 4, "php" -> 2, "c++" -> 7, "python" -> 3);
        
        println(mp.keys);
    }
}
  
  
  
  
/*
run:
  
Set(scala, php, c++, python)
  
*/

 



answered Jun 2, 2021 by avibootz

Related questions

1 answer 240 views
240 views asked Jun 2, 2021 by avibootz
3 answers 104 views
1 answer 103 views
1 answer 88 views
3 answers 114 views
1 answer 83 views
...