Collection<File> () { Collection<File> result = new ArrayList<>(); for (int i = 0; i < getChildCount(); i++){ FileOrDirectoryTreeNode child = (FileOrDirectoryTreeNode)getChildAt(i); result.addAll(child.getFiles()); } return result; }