How can I make custom toString for Array?

590 Views Asked by At

I want to be able to write:

val a = Array(1,2,3)
println(a.toString)

And have a meaningfull printout. Is it possible?

1

There are 1 best solutions below

3
On BEST ANSWER

You have to do this:

scala> val a = Array(1, 2, 3)
a: Array[Int] = Array(1, 2, 3)

scala> println(a.deep)
Array(1, 2, 3)

scala>