boolean () { boolean oneSubmenuFound = false; int countSelectables = 0; for (int i = 0; i < myListModel.getSize(); i++) { Object elementAt = myListModel.getElementAt(i); if (getListStep().isSelectable(elementAt) ) { countSelectables ++; if (getStep().hasSubstep(elementAt)) { if (oneSubmenuFound) { return false; } oneSubmenuFound = true; } } } return oneSubmenuFound && countSelectables == 1; }