Because the definition of “equals” for Arrays is that they refer to the same array.
This is consistent with Java’s array equality, using Object.Equals
, so it compares references.
If you want to check pairwise elements, then use sameElements
Array('a','b').sameElements(Array('a','b'))
or deepEquals
, which has been deprecated in 2.8, so instead use:
Array('a','b').deep.equals(Array('a','b').deep)
There’s a good Nabble discussion on array equality.