Wednesday, 11 September 2013

Why does List.toString and Vector.toString return a nice representation but not Array.toString?

Why does List.toString and Vector.toString return a nice representation
but not Array.toString?

scala> Array(1, 2, 3).toString
res1: String = [I@11cf437c
scala> List(1, 2, 3).toString
res2: String = List(1, 2, 3)
scala> Vector(1, 2, 3).toString
res3: String = Vector(1, 2, 3)
Logically, one would expect Array(1, 2, 3).toString to return "Array(1, 2,
3)".

No comments:

Post a Comment