List<Object> () { List<Object> result = new ArrayList<>(); if (isReleased()) return result; Enumeration<TreePath> enumeration = myTree.getExpandedDescendants(getPathFor(getRootNode())); if (enumeration != null) { while (enumeration.hasMoreElements()) { TreePath each = enumeration.nextElement(); Object eachElement = getElementFor(each.getLastPathComponent()); if (eachElement != null) { result.add(eachElement); } } } return result; }