Skip to content

Commit

Permalink
OAK-11430 : removed usage of Guava Iterables.all (#2026)
Browse files Browse the repository at this point in the history
Co-authored-by: Rishabh Kumar <[email protected]>
  • Loading branch information
rishabhdaim and Rishabh Kumar authored Jan 26, 2025
1 parent 4b08568 commit 2cc7f3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.function.Supplier;
import java.util.stream.StreamSupport;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.oak.commons.sort.StringSort;
Expand Down Expand Up @@ -75,7 +76,6 @@
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;

import static org.apache.jackrabbit.guava.common.collect.Iterables.all;
import static org.apache.jackrabbit.guava.common.collect.Iterators.partition;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
Expand Down Expand Up @@ -2304,7 +2304,7 @@ private Iterator<String> previousDocIdsFor(NodeDocument doc) {
Map<Revision, Range> prevRanges = doc.getPreviousRanges(true);
if (prevRanges.isEmpty()) {
return Collections.emptyIterator();
} else if (all(prevRanges.values(), FIRST_LEVEL::test)) {
} else if (IterableUtils.matchesAll(prevRanges.values(), FIRST_LEVEL::test)) {
// all previous document ids can be constructed from the
// previous ranges map. this works for first level previous
// documents only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections4.IterableUtils;
import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
import org.junit.Test;

import static org.apache.jackrabbit.guava.common.collect.Iterables.all;
import static org.apache.jackrabbit.oak.plugins.document.TestUtils.IS_LAST_REV_UPDATE;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -64,7 +64,7 @@ private static final class TestStore extends MemoryDocumentStore {
@Override
public <T extends Document> List<T> createOrUpdate(Collection<T> collection,
List<UpdateOp> updateOps) {
if (all(updateOps, IS_LAST_REV_UPDATE::test)) {
if (IterableUtils.matchesAll(updateOps, IS_LAST_REV_UPDATE::test)) {
assertTrue(updateOps.size() <= UnsavedModifications.BACKGROUND_MULTI_UPDATE_LIMIT);
}
return super.createOrUpdate(collection, updateOps);
Expand Down

0 comments on commit 2cc7f3d

Please sign in to comment.