- 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.
推薦閱讀
- Vue.js 3.x快速入門
- scikit-learn Cookbook
- Python Data Analysis(Second Edition)
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- QGIS By Example
- RealSenseTM互動開發實戰
- 基于SpringBoot實現:Java分布式中間件開發入門與實戰
- Learning YARN
- Python程序設計與算法基礎教程(第2版)(微課版)
- JavaScript程序設計(第2版)
- 30天學通C#項目案例開發
- Visual Basic 程序設計實踐教程
- Using Yocto Project with BeagleBone Black
- 量子計算機編程:從入門到實踐
- 系統分析師UML用例實戰