Printing of array-valued elements
Robert Field
robert.field at oracle.com
Thu Aug 6 20:16:52 UTC 2015
As always in Java, there will be objects which only print out well when using a custom print method (which is easy to do in JShell), special-casing seems like complexity with payback that would rarely be used (or known to exist).
-Robert
> On Aug 6, 2015, at 12:53 AM, Ben Evans <benjamin.john.evans at gmail.com> wrote:
>
> Should "bigness" be a configurable parameter? I can see it being
> irritating to have an array that is just too big to be printed out in
> full.
>
> On Mon, Aug 3, 2015 at 10:13 PM, Jonathan Gibbons
> <jonathan.gibbons at oracle.com> wrote:
>>
>>
>> On 08/03/2015 12:31 PM, Brian Goetz wrote:
>>>
>>> The toString() method on arrays is generally unhelpful (inherited from
>>> Object.) Since jshell is a read-eval-PRINT loop, it might be nice to print
>>> the result of array-valued expressions in a friendlier manner, such as by
>>> using Arrays.toString(array) instead of array.toString(). (Might want to
>>> limit this to arrays of below a certain length. (Might want to allow that
>>> limit to be set by preferences.))
>>>
>>> So we'd get
>>>
>>> [ 1, 2, 3 ]
>>>
>>> instead of
>>>
>>> [I at 2048230
>>>
>>
>> If arrays are big, how about printing "the first few" and "the last few",
>> separate by "...", as in
>>
>> [ 1, 2, 3, ..., 98, 99, 100 ]
>>
>> -- Jon
More information about the kulla-dev
mailing list