alagodasii commented on code in PR #2113:
URL: https://github.com/apache/jackrabbit-oak/pull/2113#discussion_r1975053647


##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/Aggregate.java:
##########
@@ -588,37 +588,36 @@ public Matcher match(String name, NodeState nodeState) {
             }
         }
 
-        public Collection<Matcher> nextSet() {
+        public List<Matcher> nextSet() {
             checkArgument(status != Status.FAIL);
 
-            if (status == Status.MATCH_FOUND){
+            if (status == Status.MATCH_FOUND) {
                 Aggregate nextAgg = 
currentInclude.getAggregate(matchedNodeState);
-                if (nextAgg != null){
+                if (nextAgg != null) {
                     int recursionLevel = aggregateStack.size() + 1;
 
-                    if (recursionLevel >= 
rootState.rootAggregate.reAggregationLimit){
-                        return Collections.emptyList();
+                    if (recursionLevel >= 
rootState.rootAggregate.reAggregationLimit) {
+                        return List.of();
                     }
 
                     List<Matcher> result = new 
ArrayList<>(nextAgg.includes.size());
-                    for (Include i : nextAgg.includes){
-                        result.add(new Matcher(this,  i, currentPath));
+                    for (Include i : nextAgg.includes) {
+                        result.add(new Matcher(this, i, currentPath));
                     }
                     return result;
                 }
-                return Collections.emptyList();
+                return List.of();

Review Comment:
   For the readability reasons, `emptyList()` vs `List.of()` is arguable. Some 
could say, that "list of nothing" is less readable than "empty list of 
whatever". More interesting is that performance impact. I'm curious what would 
be the gain of performance after switch. Since, there are no performance tests 
in place, it would be worth to monitor executions and compare to historical 
ones.



-- 
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