public void fetchAllLeafComponents(List<CourseComponent> leaves,EnumSet<BlockType> types){
  if (!isContainer() && types.contains(type)) {
    leaves.add(this);
  }
 else {
    for (    CourseComponent comp : children) {
      comp.fetchAllLeafComponents(leaves,types);
    }
  }
}

public void fetchAllLeafComponents ( List < CourseComponent > leaves , EnumSet < BlockType > types ) { if ( ! isContainer ( ) && types . contains ( type ) ) { leaves . add ( this ) ; } else { for ( CourseComponent comp : children ) { comp . fetchAllLeafComponents ( leaves , types ) ; } } }
we get all the leaves below this node . if this node itself is leaf , just add it to list
