public static boolean isIterable(PsiExpression expression) {
    final PsiElement parent = expression.getParent();
    if (parent instanceof PsiLocalVariable var) {
      return isIterable(var.getType());
    }
    else if (parent instanceof PsiReturnStatement) {
      return isIterable(PsiTypesUtil.getMethodReturnType(parent));
    }
    else if (parent instanceof PsiExpressionList expressionList) {
      if (expressionList.getParent() instanceof PsiMethodCallExpression call) {
        final PsiMethod method = call.resolveMethod();
        if (method != null) {
          final PsiParameter[] parameters = method.getParameterList().getParameters();
          final PsiExpression[] arguments = expressionList.getExpressions();
          if (parameters.length == arguments.length) {
            final int index = ArrayUtil.indexOf(arguments, expression);
            if (index != -1) {
              return isIterable(parameters[index].getType());
            }
          }
        }
      }
    }
    else if (parent instanceof PsiMethodCallExpression call) {
      return isIterable(call);
    }
    return false;
  }
public static boolean isIterable(PsiExpression expression)