I am looking for an idiomatic solution to this problem.
I am building a val Scala (immutable) Map and would like to optionally add one or more items:
val
How about something along the lines of
val optional = if(condition) Seq((key3 -> value3)) else Nil val entities = Seq(key1 -> value1, key2 -> value2) ++ optional val aMap = Map(entities:_*)