
上QQ阅读APP看书,第一时间看更新
Unit
Scala's Unit is a subtype of AnyVal, and the implementation contains the equals method, which returns a true value if the passed argument is also a Unit which means a value (), that is, just a pair of parentheses otherwise false. Other methods are hashCode and toString, which return an implementation-specific hash code and () respectively, because Unit has only one value: (), which is equivalent to Java's void type.