Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactor bad smell ToArrayCallWithZeroLengthArrayArgument #1580

Closed

Commits on Mar 11, 2023

  1. Refactor bad smells:

    - 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 <code>size</code> and <code>toArray</code>
    calls. This may result in extra <code>null</code>s at the end of the array if the collection was concurrently
    shrunk during the operation.</p>
    See https://shipilev.net/blog/2016/arrays-wisdom-ancients/ for more details.
    MartinWitt committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    dd414a9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b6e88e View commit details
    Browse the repository at this point in the history