- Functional Kotlin
- Mario Arias Rivu Chakraborty
- 110字
- 2021-06-24 19:15:25
Canonical methods
Canonical methods are the methods declared in Any. Therefore, all instances in Kotlin have them.
For data classes, Kotlin creates correct implementations of all canonical methods.
The methods are as follows:
- equals(other: Any?): Boolean: This method compares value equivalence, rather than reference.
- hashCode(): Int: A hash code is a numerical representation of an instance. When hashCode() is invoked several times in the same instance, it should always return the same value. Two instances that return true when they are compared with equals must have the same hashCode().
- toString(): String: A String representation of an instance. This method will be invoked when an instance is concatenated to a String.
推薦閱讀
- Oracle從入門到精通(第3版)
- Moodle Administration Essentials
- JIRA 7 Administration Cookbook(Second Edition)
- 軟件測(cè)試項(xiàng)目實(shí)戰(zhàn)之性能測(cè)試篇
- Unity Virtual Reality Projects
- Scratch真好玩:教小孩學(xué)編程
- Spring快速入門
- Linux:Embedded Development
- Python Data Analysis Cookbook
- ROS機(jī)器人編程實(shí)戰(zhàn)
- Applied Deep Learning with Python
- 算法精解:C語言描述
- Vue.js 3.x高效前端開發(fā)(視頻教學(xué)版)
- C# 7 and .NET Core 2.0 Blueprints
- 換個(gè)姿勢(shì)學(xué)C語言