Skip to content

Commit

Permalink
OAK-11311: Remove usage of Guava ImmutableList - oak-commons
Browse files Browse the repository at this point in the history
  • Loading branch information
reschke committed Dec 20, 2024
1 parent 0c827c3 commit 36b7820
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.apache.commons.io.LineIterator;
import org.apache.jackrabbit.guava.common.base.Splitter;

import org.apache.jackrabbit.guava.common.collect.ImmutableList;
import org.apache.jackrabbit.oak.commons.collections.CollectionUtils;
import org.apache.jackrabbit.oak.commons.io.FileLineDifferenceIterator;
import org.jetbrains.annotations.Nullable;
import org.junit.Test;
Expand Down Expand Up @@ -159,12 +159,12 @@ private static List<String> escape(List<String> list) {

private static void assertReverseDiff(String marked, String all, List<String> diff) throws IOException {
Iterator<String> itr = createItr(all, marked);
assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}

private static void assertDiff(String marked, String all, List<String> diff) throws IOException {
Iterator<String> itr = createItr(marked, all);
assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}

private static Iterator<String> createItr(String marked, String all) throws IOException {
Expand All @@ -189,6 +189,6 @@ public String apply(@Nullable String input) {
}
});

assertThat("marked: " + marked + " all: " + all, ImmutableList.copyOf(itr), is(diff));
assertThat("marked: " + marked + " all: " + all, CollectionUtils.toList(itr), is(diff));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
import java.util.List;
import java.util.Set;

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

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -106,7 +105,7 @@ private void assertConstraints(List<String> paths) throws IOException {
Collections.sort(paths, comparator);
collector.sort();

List<String> sortedPaths = ImmutableList.copyOf(collector.getIds());
List<String> sortedPaths = CollectionUtils.toList(collector.getIds());
assertEquals(paths.size(), sortedPaths.size());
assertEquals(paths, sortedPaths);
}
Expand All @@ -123,7 +122,7 @@ private static List<String> createTestPaths(int depth, boolean permutation){

if (permutation) {
List<String> newRoots = new ArrayList<>();
CollectionUtils.permutations(rootPaths).
org.apache.commons.collections4.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)));
Expand Down

0 comments on commit 36b7820

Please sign in to comment.