List<AutoCompletionCommand> (Collection<SearchEverywhereContributor<?>> contributors, JTextComponent textComponent) { return contributors.stream() .filter(c -> c instanceof AutoCompletionContributor) .map(c -> ((AutoCompletionContributor)c)) .flatMap(c -> c.getAutocompleteItems(textComponent.getText(), textComponent.getCaretPosition()).stream()) .collect(Collectors.toList()); }