use of com.sun.javafx.collections.UnmodifiableListSet in project JFoenix by jfoenixadmin.
the class JFXNodeUtils method getAllChildren.
public static <T> Set<T> getAllChildren(Node root, Class<T> childClass) {
final List<T> selectedChildren = new ArrayList<>();
Queue<Node> queue = new ArrayDeque<>();
queue.add(root);
while (!queue.isEmpty()) {
Node head = queue.poll();
if (childClass.isInstance(head)) {
selectedChildren.add((T) head);
} else if (Region.class.isInstance(head)) {
((Region) head).getChildrenUnmodifiable().forEach(queue::offer);
}
}
return new UnmodifiableListSet<>(selectedChildren);
}
Aggregations