menu.getItems().toArray(new RadioMenuItem[]{}) : new RadioMenuItem[]{};
final List<MenuItem> its = new ArrayList<MenuItem>();
boolean duplicate = false;
for (final Object ic : itemContents) {
duplicate = false;
final RadioMenuItem mi = new RadioMenuItem(ic == null ? "" : ic.toString());
for (final RadioMenuItem ei : existingMenuItems) {
if (ei.getText().equals(mi.getText())) {
duplicate = true;
break;
}
}
if (!duplicate) {
mi.setId("choice-box-menu-item");
mi.setToggleGroup(toggleGroup);
mi.setOnAction(new EventHandler<ActionEvent>() {
public void handle(final ActionEvent event) {
setSelectionText(((MenuItem)event.getSource()).getText());
}
});
its.add(mi);