One more question, would it be possible to overrid...
# announcements
z
One more question, would it be possible to override the equals and hashcode methods on the ByteArray from the Kotlin standard library, to check for value equality rather then referential equality? Extension methods seem to be shadowed by member declarations, but is there some other way of doing that or do I have to manually do this in all data classes that contain ByteArrays?
k
No, there's no real solution for arrays. You could use a list or create your own wrapper class that does implement
equals
as you want.
z
I see, thank you.
k
use
ByteArray.contentEquals
instead?
k
But that doesn't help when using a
ByteArray
as a data class property.
k
no, you have to override hashcode and equals for the dataclass still
annoying indeed
i missed the last part of your question where you mention data classes. sorry.
i override and use
contentEquals
where appropriate