private static boolean isCollectionLoopStatement(PsiWhileStatement whileStatement) {
      final PsiStatement initialization = getPreviousStatement(whileStatement);
      final PsiVariable variable = ForCanBeForeachInspection.getIterableVariable(initialization, false);
      if (variable == null) {
        return false;
      }
      final PsiExpression condition = whileStatement.getCondition();
      if (!ForCanBeForeachInspection.isHasNext(condition, variable)) {
        return false;
      }
      if (!ForCanBeForeachInspection.hasSimpleNextCall(variable, whileStatement.getBody())) {
        return false;
      }
      PsiElement nextSibling = whileStatement.getNextSibling();
      while (nextSibling != null) {
        if (VariableAccessUtils.variableValueIsUsed(variable, nextSibling)) {
          return false;
        }
        nextSibling = nextSibling.getNextSibling();
      }
      return true;
    }
private static boolean isCollectionLoopStatement(PsiWhileStatement whileStatement)