Created
October 20, 2017 06:07
-
-
Save Tapchicoma/6bdd2c9f7bd2742d8e792ef33ad2dd45 to your computer and use it in GitHub Desktop.
Kotlin common class equals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass(val a: Int, val b: Int, ... ) { | |
override fun equals(other: Any?) = | |
other is MyClass && compareValuesBy(this, other, MyClass::a, MyClass::b, ...) == 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment