void (KeyEvent e) { if (mySearchOption.isShowing() && myOptionShortcutSet != null) { KeyStroke eventKeyStroke = KeyStroke.getKeyStrokeForEvent(e); boolean match = Arrays.stream(myOptionShortcutSet.getShortcuts()) .filter(s -> s.isKeyboard()) .map(s -> ((KeyboardShortcut)s)) .anyMatch(s -> eventKeyStroke.equals(s.getFirstKeyStroke()) || eventKeyStroke.equals(s.getSecondKeyStroke())); if (match) { mySearchOption.click(); e.consume(); return; } } super.processKeyEvent(e); }