k -> new ArrayList<>())
.add(action);
}
- actionsByCategory.forEach((k, v) -> {
+ for (var entry : actionsByCategory.entrySet())
+ {
+ var category = entry.getKey();
+ var actions = entry.getValue();
// create submenu named {subcategory} with {service} or use root menu
- var atMenu = k.isEmpty() ? menu : new JMenu(String.format("%s with %s", k, service.getName()));
+ var atMenu = category.isEmpty() ? menu : new JMenu(String.format("%s with %s", category, service.getName()));
if (atMenu != menu)
menu.add(atMenu); // add only if submenu
// sort actions by name pulling nulls to the front
- v.sort(Comparator.comparing(
+ actions.sort(Comparator.comparing(
ActionI::getName, Comparator.nullsFirst(Comparator.naturalOrder())));
- for (int i = 0; i < v.size(); i++) {
- addEntriesForAction(v.get(i), atMenu, atMenu == menu);
+ for (int i = 0; i < actions.size(); i++) {
+ addEntriesForAction(actions.get(i), atMenu, atMenu == menu);
}
- });
+ }
}
}