String (PsiMethod lambdaHandler) { final PsiType type = lambdaHandler.getReturnType(); if (type instanceof PsiArrayType arrayType) { final PsiType arrayComponentType = arrayType.getComponentType(); return "toArray(" + arrayComponentType.getCanonicalText() + "[]::new)"; } else if (type instanceof PsiClassType classType) { final PsiClass resolvedClass = classType.resolve(); if (resolvedClass == null) { return null; } final String qName = resolvedClass.getQualifiedName(); if (qName == null) { return null; } return switch (qName) { case CommonClassNames.JAVA_UTIL_LIST, CommonClassNames.JAVA_UTIL_COLLECTION, CommonClassNames.JAVA_LANG_ITERABLE -> "collect(" + StreamApiConstants.JAVA_UTIL_STREAM_COLLECTORS + ".toList())"; case CommonClassNames.JAVA_UTIL_SET -> "collect(" + StreamApiConstants.JAVA_UTIL_STREAM_COLLECTORS + ".toSet())"; case CommonClassNames.JAVA_UTIL_ITERATOR -> "iterator()"; default -> null; }; } return null; }