When I am scanning code with sonar lint the following code shows the bug as "The return value of "orElseThrow" must be used"
itemList.stream()
.filter(item -> orderItemId.equals(item.getId()))
.findAny()
.orElseThrow(() -> new BadRequestException("12345","Item Not Found"));
This is just for a validation purpose no need to return anything from this statement. need to validate whether the item exists or not.
FYI: Eclipse showing a quick fix as squid:S2201
Anybody have any idea how to resolve this bug?