When I type something into the Scala interactive console, the console prints the result of the statement. If the result is too long, the console crops it (scroll right to see i
The result is not "cropped", simply println
is invoking java.lang.Arrays.toString()
(since scala.Array
is a Java array).
Specifically, Arrays
defines a toString
overload that works with Object
, which calls the toString
implementation of java.lang.Object
on every element. Such implementation prints the reference of the object, so you end up with
[Lscala.Tuple2;@4de71ca9
which is an Array
containing the reference 4de71ca9
to a scala.Tuple2
object.
That has been discussed in this ticket years ago.
In the specific case of arrays, you can simply do
println(x.mkString("\n"))
or
x foreach println
or
println(x.deep)
To answer your last edit, you can set the maximum lenght of the strings printed by the REPL
scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._, definitions._ also imported **
** Try :help, :vals, power. **
scala> vals.isettings.maxPrintString = Int.MaxValue
vals.isettings.maxPrintString: Int = 2147483647