question: private Collection < GraphNode > orderChildren ( GraphNode root ) { List < GraphNode > leafs = Lists . newArrayList ( ) ; List < GraphNode > inners = Lists . newArrayList ( ) ; for ( GraphNode node : treeData . getSuccessorNodes ( root ) ) { if ( allreadyDone . contains ( node ) ) { continue ; } SuccessorEdges successors = treeData . getSuccessors ( node ) ; if ( successors . hasSuccessors ( ) ) { inners . add ( node ) ; } else { leafs . add ( node ) ; } } leafs . addAll ( inners ) ; return leafs ; }
target:  Provide the current nodes set of children in a principled order. <p> The organic ordering of TreeModel.getSuccessors() has little meaning, and can appear to be pretty random.  Various sorting strategies are feasible: alphabetic, length of label, etc. <p> In this implementation, all leaf children are grouped at the front of the list, with the remaining nodes at the end.  This roughly approximates the view that many Filers (e.g. Package Explorer) use, with leaf files and directories partitioned from each other.