void (boolean force) { final String prevFilter = myFilterString; final JTextComponent field = (JTextComponent)myCombobox.getEditor().getEditorComponent(); final int caret = field.getCaretPosition(); myFilterString = field.getText(); if (!force && Objects.equals(myFilterString, prevFilter)) return; int prevSize = myShownItems.size(); myShownItems.clear(); myInUpdate = true; final boolean itemSelected = myCoordinates.containsKey(myFilterString) && Comparing.strEqual((String)myCombobox.getSelectedItem(), myFilterString, false); final boolean filtered; if (itemSelected) { myShownItems.addAll(myCoordinates.keySet()); filtered = false; } else { final String[] parts = myFilterString.split(" "); main: for (String coordinate : myCoordinates.keySet()) { for (String part : parts) { if (!StringUtil.containsIgnoreCase(coordinate, part)) { continue main; } } myShownItems.add(coordinate); } filtered = !myShownItems.isEmpty(); if (!filtered) { myShownItems.addAll(myCoordinates.keySet()); } myCombobox.setSelectedItem(null); } // use maven version sorter ArrayList<LibItem> items = new ArrayList<>(myShownItems.size()); for (String coord : myShownItems) { items.add(new LibItem(coord)); } items.sort((o1, o2) -> Comparing.compare(o1, o2)); myShownItems.clear(); for (LibItem it : items) { myShownItems.add(it.coord); } ((CollectionComboBoxModel<?>)myCombobox.getModel()).update(); myInUpdate = false; field.setText(myFilterString); field.setCaretPosition(caret); updateInfoLabel(); if (filtered) { if (prevSize < 10 && myShownItems.size() > prevSize && myCombobox.isPopupVisible()) { myCombobox.setPopupVisible(false); } if (!myCombobox.isPopupVisible()) { myCombobox.setPopupVisible(true); } } }