another scala
This file contains 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
class Person(var firstName: String, var lastName: String, var address: Address) { | |
def this() = this(null, null, null) | |
} | |
class Address(var city: String, var street: String) { | |
def this() = this(null, null) | |
} | |
val persons = getAListSomewhere(); | |
val filtered = for { p <- persons if p.address.city == "Kyiv"} yield p | |
val adresses = (for { p <- persons } yield p.address).toSet | |
val filteredAdresses = (for { p <- persons if p.address.city == "Kyiv" } yield p.address).toSet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment