PsiExpression (PsiForStatement statement) { final PsiExpression condition = PsiUtil.skipParenthesizedExprDown(statement.getCondition()); if (!(condition instanceof PsiBinaryExpression binaryExpression)) { return null; } final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getLOperand()); if (lhs == null) { return null; } final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getROperand()); if (rhs == null) { return null; } final IElementType tokenType = binaryExpression.getOperationTokenType(); if (JavaTokenType.LT.equals(tokenType)) { return rhs; } else if (JavaTokenType.GT.equals(tokenType)) { return lhs; } else { return null; } }