Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092365

Add a way to get the child count without creating the children property, ObservableList and listener

    Details

      Description

      ASAIU, when you for instance traverse a tree of TreeItem:s you have to check if there is any children to traverse into for every TreeItem. Since you need to call TreeItem.getChildren().isEmpty() to know this you will make sure that every single TreeItem in the tree has an associated ObservableList and a Property, as well as a listener. Normally there will be more TreeItem:s that are empty than not.

      So, please add

      TreeItem#getChildCount()
      or
      TreeItem#hasChildren()

      Note that TreeItem#isLeaf() is not the same thing since that can be set separately.

      It would also be very good if you added TreeItem.stream() for visiting a tree structure.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mgrev Mikael Grev
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: