I have code like this:
Optional<String> priorityName = null;
Optional<SiiPriorityInfo> siiPriorityInfo = getPriorityInfoById(siiClient, id.priorityId);
priorityName = getNameBySiiPriorityInfo(siiPriorityInfo);
if (priorityName.isEmpty() && id.customerId != null) {
Optional<SiiCustomerInfo> siiCustomerInfo = getCustomerInfoByCustomerId(siiClient, id.customerId);
if (siiCustomerInfo.isPresent() && siiCustomerInfo.get().getPriorityId() != null) {
siiPriorityInfo = getPriorityInfoById(siiClient, siiCustomerInfo.get().getPriorityId());
priorityName = getNameBySiiPriorityInfo(siiPriorityInfo);
}
}
How to rewrite this part use Optional ifElse?
Aucun commentaire:
Enregistrer un commentaire