Scala LanguageExtractors

Syntax

  • val extractor(extractedValue1, _ /* ignored second extracted value */) = valueToBeExtracted
  • valueToBeExtracted match { case extractor(extractedValue1, _) => ???}
  • val (tuple1, tuple2, tuple3) = tupleWith3Elements
  • object Foo { def unapply(foo: Foo): Option[String] = Some(foo.x); }

Related Examples

Case Class Extractors