Skip to content

Instantly share code, notes, and snippets.

@brunon
brunon / gist:5409596
Created April 18, 2013 02:37
Scala Case class w/ Option generic extraction
case class Query(criteria1: String, criteria2: Option[String], criteria3: Option[String])
val q = Query("test", Some("bla2"), None)
def removeOptionsFrom(product: Product): List[Any] = {
product.productIterator filterNot (None ==) map {
case Some(x) => x
case x => x
} toList
}