void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiBinaryExpression binOp = ObjectUtils.tryCast(element, PsiBinaryExpression.class); if (binOp == null) return; PsiExpression value = ExpressionUtils.getValueComparedWithNull(binOp); if (value == null || !TypeUtils.isOptional(value.getType())) return; CommentTracker ct = new CommentTracker(); String negation = myUseIsEmpty || binOp.getOperationTokenType().equals(JavaTokenType.NE) ? "" : "!"; String methodName = myUseIsEmpty ? "isEmpty" : "isPresent"; ct.replaceAndRestoreComments(binOp, negation + ct.text(value, ParenthesesUtils.METHOD_CALL_PRECEDENCE) + "." + methodName + "()"); }