void (Collection<? extends ExpectedTypeInfo> expectedTypes, Consumer<? super LookupElement> consumer, PsiClass collectors, PsiExpression qualifier) { PsiType matchingExpectation = JBIterable.from(expectedTypes).map(ExpectedTypeInfo::getType) .find(t -> TypeConversionUtil.erasure(t).equalsToText(Collector.class.getName())); if (matchingExpectation == null) return; for (Pair<String, PsiType> pair : suggestCollectors(Arrays.asList(ExpectedTypesProvider.getExpectedTypes(qualifier, true)), qualifier)) { for (PsiMethod method : collectors.findMethodsByName(pair.first, false)) { JavaMethodCallElement item = new JavaMethodCallElement(method, false, false); item.setAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE); item.setInferenceSubstitutorFromExpectedType(qualifier, matchingExpectation); consumer.consume(PrioritizedLookupElement.withPriority(item, 1)); } } }