boolean (int keyCode) { if (!isPopupActive()) return false; Iterator<Item> it; if (keyCode == KeyEvent.VK_UP) { it = iterate(getSelection(), false, UISettings.getInstance().getCycleScrolling()); } else if (keyCode == KeyEvent.VK_DOWN) { it = iterate(getSelection(), true, UISettings.getInstance().getCycleScrolling()); } else if (keyCode == KeyEvent.VK_HOME) { it = iterate(null, true); } else if (keyCode == KeyEvent.VK_END) { it = iterate(null, false); } else { return false; } it = JBIterator.from(it).filter(item -> isMatching(item)); if (it.hasNext()) { select(it.next()); } return true; }