void () { while (!myChildren.isEmpty() && (myChildren.get(0) instanceof Separator s) && s.getText() != null) { myChildren.remove(0); } while (!myChildren.isEmpty() && myChildren.get(myChildren.size() - 1) instanceof Separator) { myChildren.remove(myChildren.size() - 1); } for (int i = 1; i < myChildren.size() - 1; i++) { if (myChildren.get(i) instanceof Separator && myChildren.get(i + 1) instanceof Separator) { myChildren.remove(i); i--; } } }