uschindler commented on PR #15821: URL: https://github.com/apache/lucene/pull/15821#issuecomment-4069953011
> I might be missing something, but I believe `Collections.unmodifiableList(Arrays.asList(clauses))` would be more memory-efficient in this case, since it simply wraps the original array (to keep the BooleanQuery immutable), whereas `List.of` would clone it. Actually the current code is flawed, because the list of clauses passted in the constructor is modifable (you can just "patch" the array with different clauses). So using List.of() makes sure we have a private internal clone. So this is actually a good thing. The array passed in the constrcutor is likely garbage collected anyways after the ctor was called. The code here is better. -- 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]
