value:
...
number
...
number
integer fraction exponent
public List<Receipt> buildTitle(List<ComServiceResponse> comServiceResponses) {
return comServiceResponses.stream()
.map(ComServiceResponse::getComment)
.map(Comment::getComs)
.filter(Objects::nonNull)
.flatMap(List::stream) // Collection::stream ?
.map(comService -> { // todo:: extract to mapping method
var date = calendarService.formatDate(comService.getPeriod()); // todo :: check for null here and below
var paymentStatus = isPayed(comService.getComment().getComs());
var totalAmount = calculateComServiceTotalAmount(comService.getComment().getComs());
var receipt = new Receipt(); // todo:: beter use fluent accessors or builder
receipt.setPeriod(date);
receipt.setPayed(paymentStatus);
receipt.setTotalAmount(totalAmount);
receipt.setAccount(comService.getAccount());
receipt.setServiceIcon(properties.getMyVillageIcon());
receipt.setName(comService.getComment().getComs().get(0).getOwner());
receipt.setAddress(comService.getComment().getComs().get(0).getAddress());
return receipt;
})
.toList();
}