gora
gora copied to clipboard
refactor: refactor bad smell ToArrayCallWithZeroLengthArrayArgument
Repairing Code Style Issues
ToArrayCallWithZeroLengthArrayArgument
The performance of the empty array version is the same, and sometimes even better, compared
to the pre-sized version. Also, passing a pre-sized array is dangerous for a concurrent or
synchronized collection as a data race is possible between the size
and toArray
calls. This may result in extra null
s at the end of the array if the collection was concurrently
shrunk during the operation.
Repairing Code Style Issues
- ToArrayCallWithZeroLengthArrayArgument (8)