'Best way to reset all textfields present in one tab?

To set all text fields to "" present in one tab (there are also labels and other node type), instead of passing each explicitly using textTf.setext(""), I use this way:

List<Node> elements = ((Parent) cycleResults.getContent()).getChildrenUnmodifiable();
            
for (Node inod :elements ) {  
    String type = inod.getTypeSelector();
    if (type.contentEquals("TextField"))   {      ((TextField) inod).setText("");    }
}

I would like to know is there is a more recommended/nice way to do it.

enter image description here

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source