4

suppose I have a case class

scala> case class a(value:List[Int]) 
scala> val c1 = a(List(1,2,3)) 
scala> val c2 = a(List(1,2,3))
scala> c1 == c2
res2: Boolean = true

But when I change List to Array

scala> case class b(value:Array[Int])
scala> val c3 = b(Array(1,2,3))
scala> val c4 = b(Array(1,2,3))
scala> c3 == c4
res3: Boolean = false

But what I really expect is c3 and c4 are equal. Why is this happen?

Jade Tang
  • 321
  • 4
  • 23
  • This is basically the same question as http://stackoverflow.com/questions/3737711/why-doesnt-arrays-function-return-true-for-array1-2-array1-2 – ntalbs May 08 '15 at 07:25
  • You can find an an answer in [this link][1]. [1]: http://stackoverflow.com/questions/5393243/how-do-i-compare-two-arrays-in-scala – Carlos Vilchez May 08 '15 at 07:25

0 Answers0