As far as I understand, Scala's == defines the natural equality of two objects.
I expected that Array(0,1,2) == Array(0,1,2)
compares the natural equality e. g. checks if all elements of the array return true when compared with the corresponding elements of the other array.
People told me that Scala's Array
is just a Java []
which only compares identity. Wouldn't it be more meaningful to override Array
'sequals
method to compare natural equality instead?
Thank you for your thoughts!
Thank you all for your answers! Is there a recommended way to choose which answer gets the "tick" if there is more than one good accurate answer?