Skip to content

Instantly share code, notes, and snippets.

@PoisonousJohn
Created June 18, 2020 15:29
Show Gist options
  • Save PoisonousJohn/de5842d3ce3b035757544513facb5270 to your computer and use it in GitHub Desktop.
Save PoisonousJohn/de5842d3ce3b035757544513facb5270 to your computer and use it in GitHub Desktop.
Kotlin data class, Check fields equality by reflection
var fields = originalInvoice::class.memberProperties
var string = ""
for (field in fields) {
if (field.getter.call(originalInvoice) != field.getter.call(this)) string += "${field.name}\n"
}
string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment