This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e27b02a498 OAK-11556 : removed usage of Guava's Iterables.getFirst 
with oak-commons API (#2146)
e27b02a498 is described below

commit e27b02a4980625fdfa2fbcb3418c7f56837f5359
Author: Rishabh Kumar <[email protected]>
AuthorDate: Fri Mar 7 20:44:43 2025 +0530

    OAK-11556 : removed usage of Guava's Iterables.getFirst with oak-commons 
API (#2146)
    
    * OAK-11556 : removed usage of Guava's Iterables.getFirst with 
Streams.findFirst()
    
    * OAK-11556 : removed usage of Guava's Iterables.getFirst with oak-commons
    
    ---------
    
    Co-authored-by: Rishabh Kumar <[email protected]>
---
 .../jackrabbit/oak/plugins/index/property/PropertyIndexTest.java       | 2 +-
 .../src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java | 3 ++-
 .../org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java   | 2 +-
 .../jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java    | 3 ++-
 .../java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java  | 3 ++-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
 
b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
index fb1a5e5f33..b6cbbeede6 100644
--- 
a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
+++ 
b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
@@ -1041,7 +1041,7 @@ public class PropertyIndexTest {
         assertTrue(indexedState.exists());
         Iterable<String> values = indexedState.getStrings("entry");
         assertEquals(1, IterableUtils.size(values));
-        assertEquals("/content", Iterables.getFirst(values, null));
+        assertEquals("/content", IterableUtils.getFirst(values, null));
 
         Mount roMount = mip.getMountByName("foo");
         assertFalse(getNode(indexed, "/oak:index/foo/" + 
getNodeForMount(roMount)).exists());
diff --git 
a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java 
b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
index cf6095d7d4..77c204a5ef 100644
--- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
+++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
@@ -26,6 +26,7 @@ import javax.jcr.Session;
 import org.apache.jackrabbit.guava.common.collect.Iterables;
 
 import org.apache.jackrabbit.oak.commons.FixturesHelper.Fixture;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
 import org.apache.jackrabbit.test.RepositoryStubException;
@@ -65,7 +66,7 @@ public class OakRepositoryStub extends BaseRepositoryStub {
     private static RepositoryStub newDelegate(Properties settings)
             throws RepositoryException {
         // use first fixture for stub with segment-tar as default
-        Fixture f = Iterables.getFirst(getFixtures(), Fixture.SEGMENT_TAR);
+        Fixture f = IterableUtils.getFirst(getFixtures(), Fixture.SEGMENT_TAR);
         if (f == Fixture.DOCUMENT_MEM) {
             return new OakDocumentMemRepositoryStub(settings);
         } else if (f == Fixture.DOCUMENT_RDB) {
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
index a66c26261d..8a471d99f9 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
@@ -306,7 +306,7 @@ public class VersionGCSupport {
         if (doc.getSplitDocType() != SplitDocType.DEFAULT_NO_BRANCH) {
             return false;
         }
-        Revision r = Iterables.getFirst(doc.getAllChanges(), null);
+        Revision r = IterableUtils.getFirst(doc.getAllChanges(), null);
         return r != null && sweepRevs.isRevisionNewer(r);
     }
 }
diff --git 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
index 477c391e02..2ee89aee12 100644
--- 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
+++ 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.jackrabbit.guava.common.collect.Iterables;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
 import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -260,7 +261,7 @@ public class DocumentNodeStoreSweepTest {
         Revision r = null;
         for (NodeDocument d : Utils.getAllDocuments(store)) {
             if (d.getPath().toString().startsWith("/node-")) {
-                r = Iterables.getFirst(d.getAllChanges(), null);
+                r = IterableUtils.getFirst(d.getAllChanges(), null);
                 break;
             }
         }
diff --git 
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
 
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
index 5cbc4117d2..bfe96b7ba7 100644
--- 
a/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
+++ 
b/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/memory/PropertyStates.java
@@ -32,6 +32,7 @@ import org.apache.jackrabbit.guava.common.collect.Iterables;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.commons.collections.IterableUtils;
 import org.apache.jackrabbit.oak.plugins.value.Conversions;
 import org.apache.jackrabbit.oak.plugins.value.OakValue;
 import org.apache.jackrabbit.util.ISO8601;
@@ -89,7 +90,7 @@ public final class PropertyStates {
             String name, Iterable<Value> values)
             throws RepositoryException {
         int type = PropertyType.STRING;
-        Value first = Iterables.getFirst(values, null);
+        Value first = IterableUtils.getFirst(values, null);
         if (first != null) {
             type = first.getType();
         }

Reply via email to