billableServices.add(((BillableService)response.getResponse()));
}
}
for(Response<?> response: all){
if (response.getResponse() instanceof Bill){
Bill bill = ((Bill)response.getResponse());
BigDecimal sum = new BigDecimal(0);
for (BillableService billableService: billableServices){
sum = sum.add(billableService.getAmount());
}
bill.setTotalAmount(sum);
billAdapter.publishBill(bill);
billableServices.clear();
}
}