void () { T prevSelection = myList.getSelectedValue(); // save to restore the selection on filter drop myModel.refilter(); if (myModel.getSize() > 0) { int fullMatchIndex = mySpeedSearch.isHoldingFilter() ? myModel.getClosestMatchIndex() : myModel.getElementIndex(prevSelection); if (fullMatchIndex != -1) { ScrollingUtil.selectItem(myList, fullMatchIndex); } if (myModel.getSize() <= myList.getSelectedIndex() || !myModel.contains(myList.getSelectedValue())) { ScrollingUtil.selectItem(myList, 0); } } else { mySpeedSearch.noHits(); revalidate(); } }