Skip to content

Instantly share code, notes, and snippets.

@beranradek
Created February 18, 2013 09:42
Show Gist options
  • Save beranradek/4976246 to your computer and use it in GitHub Desktop.
Save beranradek/4976246 to your computer and use it in GitHub Desktop.
// Posčítání cen automobilů, jejichž výrobcem je Porsche:
case class CarModel(carMaker: CarMaker.Value, name: String, price: Option[Int])
val models: List[CarModel] = List(...)
models.view.filter(_.carMaker == CarMaker.Porsche).map(_.price.getOrElse(0)).sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment