Код: Выделить всё
// Print object and recurse if iterable
private static void deep_print(Object o) {
System.out.println(o.getClass().toString() + ", " + o.toString());
boolean iter = false;
Iterable i1 = null;
Object[] i2 = null;
if (o instanceof Iterable) {
iter = true;
i1 = (Iterable) o;
} else if (o instanceof Object[]) {
iter = true;
i2 = (Object[]) o;
}
if (iter) {
for (Object o_ : i2 == null ? i1 : i2) deep_print(o_); // ERROR: Can only iterate over an array or an instance of java.lang.Iterable
}
Подробнее здесь: https://stackoverflow.com/questions/129 ... tor-output