3 ms·
Why does he say SubbableString example is not threadsafe? The private fields are only written during object creation.
by MichaelGG 11y ago
Why does he say SubbableString example is not threadsafe? The private fields are only written during object creation.
- rlmw 11y agoBecause he takes a reference to a char[] in the constructor without copying it. char[]s are mutable so this means that the internal state of his String can be mutated by something else without any synchronisation guarantees.