How do I compare two arrays in scala?

后端 未结 5 1456
情书的邮戳
情书的邮戳 2020-12-13 01:43
val a: Array[Int] = Array(1,2,4,5)
val b: Array[Int] = Array(1,2,4,5)
a==b // false

Is there a pattern-matching way to see if two arrays (or sequen

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 01:57

    You need to change your last line to

    a.deep == b.deep
    

    to do a deep comparison of the arrays.

提交回复
热议问题