...
Code Block | ||
---|---|---|
| ||
Person grandmother = ...Person() Collection<Person> grandchildren = new ArrayList<Person>(); // Person.getChildren() returns the children as a Collection for (Person child : grandmother.getChildren()) { // Collection.addAll takes another Collection as its only argument grandchildren.addAll(child.getChildren()); } |
...