IterationResultHolder (final TreeNode node) { if (! (node instanceof RepositoryTreeNode)) { return IterationResultHolder.RESULT; } if (! node.isLeaf()) { // folder. folders come first return IterationResultHolder.SKIP; } return IterationResultHolder.DO_NOTHING; }