How do I compare two arrays in scala? How do I compare two arrays in scala? arrays arrays

How do I compare two arrays in scala?


You need to change your last line to

a.deep == b.deep

to do a deep comparison of the arrays.


From Programming Scala:

Array(1,2,4,5).sameElements(Array(1,2,4,5))


  a.corresponds(b){_ == _}

Scaladoc: true if both sequences have the same length and p(x, y) is true for all corresponding elements x of this wrapped array and y of that, otherwise false