I am having problems with intellijs Ultimate code inspection! It is only showing me the basic inspection/alternatives for code replacement like "Invert if condition" and nothing else. I have checked on the preferences if everything is selected and I also reinstalled intellij but still not working!
It used to give me more alternatives for code replacement not only the "Invert if condition" but there were more alternatives. One of them was "Replace Optional.isPresent() condition with functional style expression"
So whenever I wrote :
if (userOptional.isPresent()) {
return ResponseEntity.ok(userOptional.get());
}
return ResponseEntity.status(HttpStatus.NOT_FOUND).
body(new ErrorMessage("User " + id + " was not found"));
... it used to give me this kind of replacement:
return userOptional.<ResponseEntity<?>>map(ResponseEntity::ok)
.orElseGet(()->ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(new ErrorMessage("User " + id + " was not found")));