reschke commented on code in PR #1968:
URL: https://github.com/apache/jackrabbit-oak/pull/1968#discussion_r1908925574


##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java:
##########
@@ -520,6 +521,34 @@ public static <T> Stream<T> toStream(@NotNull Iterator<T> 
iterator) {
         return StreamSupport.stream(toIterable(iterator).spliterator(), false);
     }
 
+    public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> 
iterable2) {
+        Objects.requireNonNull(iterable1);
+        Objects.requireNonNull(iterable2);
+
+        if (iterable1 instanceof Collection && iterable2 instanceof 
Collection) {
+            Collection<?> collection1 = (Collection<?>) iterable1;
+            Collection<?> collection2 = (Collection<?>) iterable2;
+            if (collection1.size() != collection2.size()) {
+                return false;
+            }
+        }
+

Review Comment:
   I would out that into an "else" (return values from the same nesting level).



##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/collections/CollectionUtils.java:
##########
@@ -520,6 +521,34 @@ public static <T> Stream<T> toStream(@NotNull Iterator<T> 
iterator) {
         return StreamSupport.stream(toIterable(iterator).spliterator(), false);
     }
 
+    public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> 
iterable2) {
+        Objects.requireNonNull(iterable1);
+        Objects.requireNonNull(iterable2);
+
+        if (iterable1 instanceof Collection && iterable2 instanceof 
Collection) {
+            Collection<?> collection1 = (Collection<?>) iterable1;
+            Collection<?> collection2 = (Collection<?>) iterable2;
+            if (collection1.size() != collection2.size()) {
+                return false;
+            }
+        }
+

Review Comment:
   I would put that into an "else" (return values from the same nesting level).



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