How to declare empty list and then add string in scala?

Viewed 197835

I have code like this:

val dm  = List[String]()
val dk = List[Map[String,Object]]()

.....

dm.add("text")
dk.add(Map("1" -> "ok"))

but it throws runtime java.lang.UnsupportedOperationException.

I need to declare empty list or empty maps and some where later in the code need to fill them.

7 Answers
Related