I've done enough Scala to know what ugly code looks like. Observe:
val sm Option[Map[String,String]] = Some(Map("Foo" -> "won", "Bar" -> "too", "Baz" -> "tree"))
Expected output:
: String = Foo=won,Bar=too,Baz=tree
Here's my Tyler Perry code directed by M. Knight Shama Llama Yama:
val result = (
for {
m <- sm.toSeq;
(k,v) <- m
} yield s"$k=$v"
).mkString(",")
However this does not work when sm is None :-( . I get an error saying that Nothing has no "filter" method (it thinks we're filtering on line (k,v) <- m
) Gracias!