ebyhr opened a new pull request, #16254: URL: https://github.com/apache/iceberg/pull/16254
The existing `findFirst` silently hides multiple matching elements. This PR replaces it with Guava [MoreCollectors](https://www.javadoc.io/doc/com.google.guava/guava/latest/com/google/common/collect/MoreCollectors.html): onlyElement method: > A collector that takes a stream containing exactly one element and returns that element. The returned collector throws an IllegalArgumentException if the stream consists of two or more elements, and a NoSuchElementException if the stream is empty. toOptional method: > A collector that converts a stream of zero or one elements to an Optional. > Throws: IllegalArgumentException - if the stream consists of two or more elements. > Throws: NullPointerException - if any element in the stream is null. I only updated a few places to demonstrate how to use them. -- 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]
