String (PsiType itemType, PsiType expectedType) { String methodName = "asList"; PsiType componentType = PsiUtil.extractIterableTypeParameter(expectedType, true); if (componentType == null) { methodName = "stream"; componentType = getStreamComponentType(expectedType); PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(componentType); if (unboxedType != null) { componentType = unboxedType; } } if (componentType == null || !(itemType instanceof PsiArrayType) || !componentType.isAssignableFrom(((PsiArrayType)itemType).getComponentType())) { return null; } return methodName; }