I have Optional object
Optional<Instrument> instrument = instrumentService.findOne(id);
And i have two scenario. First return ResponseEntity.ok if object is present and second is return ResponseEntity.noContent().build(). I have function
instrument.map(instrument1 -> {
return ResponseEntity.ok(instrumentMapper.toDto(instrumentRepository.save(instrument1)));
})
.//return noContent here;
What i need to write after dot to return necessary part?