uschindler commented on PR #15823: URL: https://github.com/apache/lucene/pull/15823#issuecomment-4133840468
> > Java 8+ users: several common uses for this class are now more comprehensively addressed by the new Stream library. Read the method documentation below for comparisons. This class is not being deprecated, but we gently encourage you to migrate to streams. > > OK, Stream is also encouraged by Guava. > > So we can add a method `#addAll(Collection<S> elements, Function<S, T> elementTransformer)` and use `elements.stream().map(elementTransformer)` to filter in it, or `#addAll(Stream<T> stream)` and let the caller to filter or not but need removing the size validation. > > > we don't know size before so allocation may be harder and ineffective. > > I am a bit confused about why the size of elements affects PQ's allocation, Is the PQ not allcated according to its `maxSize`? For PQ, no - it has a fixed size, so the typical forEach is enough. Sorry, I mixed it up. But wasn't also DisjunctionScorer involved here that has lists internally that need to be precalculated. Anyways, PQ is the deal here. Anyways, if the size is not required to optimize any allocation then lets go with the above ideas! -- 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]
