void (@NotNull Lookup lookup, @NotNull String newPrefix) { ArrayList<LookupElement> itemCopy = new ArrayList<>(myItems); myItems.clear(); for (LookupElement item : itemCopy) { if (item.isValid()) { PrefixMatcher matcher = itemMatcher(item).cloneWithPrefix(newPrefix); if (matcher.prefixMatches(item)) { item.putUserData(myMatcherKey, matcher); myItems.add(item); } } } prefixChanged(lookup); }