Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



#extractor-objects #scala
The apply method is not necessary for pattern matching. It is only used to mimick a constructor. val x = Twice(21) expands to val x = Twice.apply(21).
If you want to change selection, open document below and click on "Move attachment"

Extractor Objects - Scala Documentation
use an invocation of Twice.unapply, which is used to match any even number; the return value of the unapply signals whether the argument has matched or not, and any sub-values that can be used for further matching. Here, the sub-value is z/2 <span>The apply method is not necessary for pattern matching. It is only used to mimick a constructor. val x = Twice(21) expands to val x = Twice.apply(21). The return type of an unapply should be chosen as follows: * If it is just a test, return a Boolean. For instance case even() * If it returns a single sub-value of type T, return an Opti


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.