@Override public void save2(Optional<CheckResponse> response) { if (response.isPresent()) { CheckResponse checkResponse = response.get(); if (checkResponse.getValue().isPresent()) { Optional<List<CheckDetails>> value = checkResponse.getValue(); if (value.isPresent()) { List<CheckDetails> checkDetails = value.get(); Stream<Checks> checksStream = checkDetails.stream().map(this::mapDtoCheckDetailsToEntiyChecks); Optional<Checks> first = checksStream.findFirst(); if (first.isPresent()) { Checks checks = first.get(); this.checkRepository.save(checks); } } } Checked checked = new Checked(); checked.setResponse(checkResponse.getResponse()); checked.setServiceResponse(checkResponse.getServiceResponse()); checked.setErrorMessage(checkResponse.getErrorMessage()); if (checkResponse.getBrokenRules().isPresent()) { List<BrokenRulesResponse> brokenRulesResponses = checkResponse.getBrokenRules().get(); brokenRulesResponses.forEach(brokenRulesResponse -> { checked.setMessage(brokenRulesResponse.getMessage()); checked.setMember(brokenRulesResponse.getMember()); this.checkedRepository.save(checked); }); } } }
if (users != null) { User user = users.get(0); if (user != null) { Address address = user.getAddress(); if (address != null) { String state = address.getState(); if (state != null) { System.out.println("State is " + state); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)