Let's say I have a function returning an immutable Map (`getMap` below) and I have two options and I I want to add an entry to the map if the option is set, otherwise leave the map unmodified.

So in non-functional code (like you would write it in java):

```
  def getMap(): Map[String, String] = {
    Map(
      "name" -> "My Name",
      "age" -> "80")
  }

  def testJavaLink() {
    val o1: Option[String] = Some("This one is set")
    val o2: Option[String] = None

    var mutableResult: mutable.Map[String, String] = mutable.Map() ++ getMap()
    if (o1.isDefined) {
      mutableResult("option1") = o1.get
    }

    if (o2.isDefined) {
      mutableResult("option2") = o2.get
    }

    val result: Map[String, String] = mutableResult.toMap
  }

```

This code is obviously not very scala-like, so I tried to do it using map-functions:

```
  def test1() {
    val o1: Option[String] = Some("This one is set")
    val o2: Option[String] = None

    val result: Map[String, String] = getMap() ++ (if (o1.isDefined) List(("option1", o1.get)) else List()) ++ (if (o2.isDefined) List(("option2", o2.get)) else List())
  }

```

But this code is horrible readable.

How can I achieve something similar using readable scala? For lists there is a nice syntax (which makes use of the fact that a Option can be turned into a Iterable which has either one or zero elements). But I don't know how to make use of this when using maps.