Method hashMapOf() in Kotlin

Viewed 12807

Can anybody please give me Concrete example of hashMapOf() method and when should I use it?

If i do something like this:

val map2 : HashMap<String, String>  = hashMapOf()
    map2["ok"] = "yes"

It means to initialize map2 property I can use it.

But like other method in Kotlin for example:

val arr = arrayListOf<String>("1", "2", "3")

Is there any way I can use this method like above?

2 Answers
Related