nfsantos commented on code in PR #2147:
URL: https://github.com/apache/jackrabbit-oak/pull/2147#discussion_r1984858696


##########
oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java:
##########
@@ -3123,7 +3125,8 @@ private String explain(String query){
     private String explainXpath(String query) throws ParseException {
         String explain = "explain " + query;
         Result result = executeQuery(explain, "xpath", NO_BINDINGS);
-        ResultRow row = Iterables.getOnlyElement(result.getRows());
+        Assert.assertEquals(1, StreamUtils.toStream(result.getRows()).count());
+        ResultRow row = 
StreamUtils.toStream(result.getRows()).findAny().orElseThrow();

Review Comment:
   This seems convoluted. After the assertion, we already know that 
result.getRows() has 1 row. So we could just get that element like this: 
`result.getRows().iterator().next()`. Or even better, to convert 
`result.getRows()` to an array or list and use this for the checks on size and 
to get the single element. Here it's not about performance, but about 
readability. 



-- 
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: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to