ComplexAssignment (@NotNull PsiStatement first, @NotNull PsiStatement second, @NotNull PsiVariable nullCheckedExtremum) { PsiAssignmentExpression secondAssignment = ExpressionUtils.getAssignment(second); if (secondAssignment == null) return null; PsiVariable loopVar = resolveVariableReference(ExpressionUtils.getAssignmentTo(first, nullCheckedExtremum)); PsiVariable extremumKey = resolveVariableReference(secondAssignment.getLExpression()); PsiExpression loopVarExpr = secondAssignment.getRExpression(); if (extremumKey == null || loopVar == null || loopVarExpr == null) return null; return new ComplexAssignment(nullCheckedExtremum, extremumKey, loopVar, loopVarExpr); }