On 12/07/2016 11:28 PM, Roger Riggs wrote:
AbstractStringBuilder:
I agree with Claes' comment suggesting that IAE for negative lengths is a pain and defining it to append 0 would be natural in many use cases.

OTOH, inserting a simple Math.max(n, 0) instead of n where n could get negative would achieve the same without complicating the expression too much. Java standard APIs have a tradition of being explicit rather than having implicit hidden logic which surely shortens many usecases, but makes them harder to read and understand for casual readers not intimately familiar with such API. The logic to treat negative lengths as 0 is implicit and not universally correct.

Regards, Peter

Reply via email to