class Composite extend Component {
private List<Component> children = new ArrayList<>();
public void add(Component component) {
children.add(component);
}
public void remove(Component component) {
children.remove(component);
}
public void getChild(Component component) {
for(Component component: children) {
component.getChild() //회귀, return Leaf일때까지
//사용하고자 하는 코드들 작성.
}
}
}