Learning Scala Programming
上QQ阅读APP看书,第一时间看更新

Boolean

A Boolean represents two values: true and false. As expected, it implements Boolean arithmetic methods such as and, or, strict and, strict or, equality, inequality, and negation in the form of &&, ||, &, |, ==, !=, and unary_! respectively. Boolean also implements equals, hashCode, and toString from the class Any.

The equals method checks for argument evaluation and returns its result, while hashCode returns a fixed implementation-specific hash code based on value true or false.