Hi Ivan,

not sure that would be an optimization, since you'd trade a conditional
write for an unconditional one. The computation itself for the empty
string has trivial cost.

/Claes

On 2019-04-08 18:12, Ivan Gerasimov wrote:
Hi Claes!

Would it make sense to preset hashIsZero = true in the empty string constructor?

The current code avoids calculating the hashCode for an empty string, and the new code doesn't seem to do that because hashIsZero = false by default for each newly constructed copy of the empty string.

With kind regards,
Ivan

Reply via email to