void (Foo parent) { List<Foo> elements = getElements(parent); /*for (Foo foo : getElements(parent)) { System.out.println(foo); }*/ for (Foo foo : getElementsArray(parent)) { System.out.println(foo); } }