Skip to content

Commit

Permalink
OAK-11304: Remove usage of Guava Collections2 - oak-commons
Browse files Browse the repository at this point in the history
  • Loading branch information
reschke committed Dec 12, 2024
1 parent 15b2afe commit 5a1f56b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion oak-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
<artifactId>commons-lang3</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -137,6 +142,6 @@
<artifactId>lz4-java</artifactId>
<version>1.8.0</version>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;
import java.util.Set;

import org.apache.jackrabbit.guava.common.collect.Collections2;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.junit.Test;

Expand Down Expand Up @@ -121,12 +121,12 @@ private static List<String> createTestPaths(int depth, boolean permutation){
List<String> rootPaths = Arrays.asList("a", "b", "c", "d", "e", "f", "g");
List<String> paths = new ArrayList<String>();


if (permutation){
List<String> newRoots = new ArrayList<String>();
for (List<String> permuts : Collections2.orderedPermutations(rootPaths)){
newRoots.add(String.join("", permuts));
}
if (permutation) {
List<String> newRoots = new ArrayList<>();
CollectionUtils.permutations(rootPaths).
stream().
sorted((a, b) -> Arrays.compare(a.toArray(new String[0]), b.toArray(new String[0]))).
forEach(permuts -> newRoots.add(String.join("", permuts)));
rootPaths = newRoots;
}

Expand Down

0 comments on commit 5a1f56b

Please sign in to comment.