First, change the code to use generics and an extended loop for. Assuming valuesthen a List<DiscountValue>, this is what you get:
List<DiscountValue> ret = new ArrayList<>(values.size());
double tmp = startPrice;
for (DiscountValue value : values) {
DiscountValue discountValue = value.apply(quantity, tmp, digits, currencyIsoCode);
tmp -= discountValue.getAppliedValue();
ret.add(discountValue);
}
, , .
, ret tmp final, .
List<DiscountValue> ret = new ArrayList<>(values.size());
double[] tmp = { startPrice };
values.stream().forEachOrdered(v -> {
DiscountValue discountValue = v.apply(quantity, tmp[0], digits, currencyIsoCode);
tmp[0] -= discountValue.getAppliedValue();
ret.add(discountValue);
});
, , . , ... .