Skip to content

Instantly share code, notes, and snippets.

@Tapchicoma
Created October 20, 2017 06:07
Show Gist options
  • Save Tapchicoma/6bdd2c9f7bd2742d8e792ef33ad2dd45 to your computer and use it in GitHub Desktop.
Save Tapchicoma/6bdd2c9f7bd2742d8e792ef33ad2dd45 to your computer and use it in GitHub Desktop.
Kotlin common class equals
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