Optionally adding items to a Scala Map
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 = entities.toMap
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 = entities.toMap