`Cart.removeItem(…)` should not return any value
Closed this issue · 1 comments
odrotbohm commented
It's more logical to return an empty CartItem
to capture the context of the operation but indicate that a zero quantity is the result of the operation. Currently, we return the CartItem
in its original state.
odrotbohm commented
CartItem
does not allow zero quantities anymore, which rules it out as a return value. In that light, I think the current arrangement is fine. The only inconsistency now is that all our methods returning an Optional<CartItem>
only return a non-empty Optional
if the CartItem
contained in it, is still attached to the Cart
. That's not the case for a removal. I'll take this ticket to remove the return value of Cart.remove(…)
entirely to avoid any ambiguities.