How do I compare two arrays in scala?
a.corresponds(b){_ == _}
Scaladoc:
true
if both sequences have the same length andp(x, y)
istrue
for all corresponding elementsx
ofthis
wrapped array andy
ofthat
, otherwisefalse
From Programming Scala:
Array(1,2,4,5).sameElements(Array(1,2,4,5))
You need to change your last line to
a.deep == b.deep
to do a deep comparison of the arrays.