Hello, can you answer me a simple question?

We have 2 looping lists:

ArrayList<Object> list1 = new ArrayList<>();
ArrayList<Object> list2 = new ArrayList<>();

list2.add(list1);
list1.add(list2);

Class GridToStringBuilder represent them into string.

Simple public static <T> String toString(Class<T> cls, T obj) method
returns string "ArrayList [size=1]" for each list.

*Question is* how should look the result of toString(Class<T> cls, T obj,
String name, @Nullable Object val) method and other methods with additional
values?
"ArrayList [size=1, name=ArrayList[size=1]]" or something else?

The trouble is in GridStringBuilder.a(Object obj) method - it tries to
append collection's toString() method which invokes toString() on every
element.

Reply via email to