I have in Scala a Map where the values are list of lists. I try to add a value with the following code:
var map = Map[String,List[List[String]]]()
val list1 = List ("A111", "B111")
var listInMap = map.getOrElse("abc", List[List[String]]())
listInMap += list1 // this line does not compile
map += ("abc" -> listInMap)
The problem is that in the line listInMap += list1
it throws type mismatch; found : List[String] required: String
. Why is String required if I need to add a list to the list? I need to add list1
to listInMap