xzel23 commented on PR #270: URL: https://github.com/apache/pdfbox/pull/270#issuecomment-3342012773
Yes, important differences between the list returned by List.of() and new ArrayList(): - List.of() does not allow null values - the list returned by List.of() is immutable, I.e., you can't add or remove elements. - the null checks you see when inserting gives the hotspot compiler the opportunity to omit null checks when retrieving elements as (at least if I recall correctly) the JVM "knows" this implementation can never return null elements. But all these do not matter in this case. IMHO, if you are sure about the changes you make, run the tests and think about any possible side effects, there's little reason not to make slightly bigger changes if the result is preferable: better readability/maintainability, performance, less allocations etc. If your code does not get through, you probably will learn something new that you did not think about, which also is a good thing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
