/** * Filters a given shortcut category * * @param shortcutCategory The to be filtered shortcut category * @return True if the shortcut category should be shown, false otherwise */ public boolean filter(ShortcutCategoryDTO shortcutCategory) { return Optional.ofNullable(searchTerm.getValueSafe()) .map(searchTerm -> shortcutCategory.getShortcuts().stream().anyMatch(this::filter)) .orElse(true); }
/** * Filters a given shortcut * * @param shortcut The to be filtered shortcut * @return True if the shortcut should be shown, false otherwise */ public boolean filter(ShortcutDTO shortcut) { final boolean searchTermConstraint = Optional.ofNullable(searchTerm.getValueSafe()) .map(searchTerm -> shortcut.getInfo().getName().toLowerCase().contains(searchTerm.toLowerCase())) .orElse(true); final boolean selectedShortcutCategoryConstraint = Optional.ofNullable(selectedShortcutCategory.getValue()) .map(selectedShortcutCategory -> selectedShortcutCategory.getShortcuts().contains(shortcut)) .orElse(true); return searchTermConstraint && selectedShortcutCategoryConstraint; }
public ShortcutDTO fetchShortcutsFromName(String name) { for (ShortcutCategoryDTO shortcutCategoryDTO : fetchShortcuts()) { for (ShortcutDTO shortcutDTO : shortcutCategoryDTO.getShortcuts()) { if (name.equals(shortcutDTO.getInfo().getName())) { return shortcutDTO; } } } return null; }
.flatMap(shortcutCategory -> shortcutCategory.getShortcuts().stream()).filter(shortcut -> { boolean toAdd = false; try {
categories.stream().flatMap(shortcutCategoryDTO -> shortcutCategoryDTO.getShortcuts().stream()) .forEach(shortcutDTO -> { final InteractiveScriptSession interactiveScriptSession = this.scriptInterpreter
public Builder(ShortcutCategoryDTO categoryDTO) { this.withId(categoryDTO.getId()).withName(categoryDTO.getName()) .withDescription(categoryDTO.getDescription()).withShortcuts(categoryDTO.getShortcuts()) .withIcon(categoryDTO.getIcon()); }