更新时间:2022-02-05 08:00:17
需要配对对象:
unapply
和 unapplySeq
方法来定义模式匹配的自定义提取器(参见 here ) apply
创建特定类的对象(但不一定是)隐含
定义;请参阅 Scala规范中的隐式解析的确切规则或此博文 unapply
and unapplySeq
methods to define custom extractors for pattern matching (see here)apply
method which is typically used as a factory method that creates objects of the particular class (but doesn't have to be)implicit
definition; see the exact rules of implicit resolution in the Scala specification or a short summary in this blog post Scala标准库中的 Boolean
对象提供了框
和 unbox
用于在原始布尔与其包装的对象表示之间进行转换。它还是(目前)用作 @specialized
注释的参数,用于表示类需要专用于哪些基本类型。
The Boolean
object in the Scala standard library provides the methods box
and unbox
used to convert between primitive booleans and their wrapped, object representations. It is additionally (currently) used as an argument to the @specialized
annotation, to denote on which primitive types the class needs to be specialized on.