Skip to content

Instantly share code, notes, and snippets.

@yurique
Created August 22, 2012 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurique/3427095 to your computer and use it in GitHub Desktop.
Save yurique/3427095 to your computer and use it in GitHub Desktop.
another scala
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