Extractors

Download scala eBook

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

Stats

349 Contributors: 15
Wednesday, December 7, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook