Last active
June 23, 2017 01:44
-
-
Save iamthiago/604e6b5ecf9ab6de51697f2fb7e90e34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Address(state: Option[String], city: Option[String], neighborhood: Option[String], street: Option[String], streetNumber: Option[String]) { | |
def toMap(): Map[String, String] = { | |
Map( | |
"state" -> this.state, | |
"city" -> this.city, | |
"neighborhood" -> this.neighborhood, | |
"street" -> this.street, | |
"streetNumber" -> this.streetNumber | |
).filter(_._2.isDefined).mapValues(_.get) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment