If I have a List of tuples, I can convert to a map with toMap
:
val x = (3 -> 3)
List(x).toMap
and I get
scala.collection.immutable.Map[Int,Int] = Map(3 -> 3)
If I have a List of Optional and try the same I would get an error:
val x = Some(3 -> 3)
val y = None
List(x, y).toMap
<console>:15: error: Cannot prove that Some[(Int, Int)] <:< (T, U).
I want to get the same result. Is it possible?