Skip to content

Commit

Permalink
OAK-11363 : removed usage of Guava's Maps.uniqueIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh Kumar committed Jan 9, 2025
1 parent 91b7fcd commit 82faccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.apache.jackrabbit.guava.common.base.Stopwatch;
import org.apache.jackrabbit.guava.common.collect.Iterators;
import org.apache.jackrabbit.guava.common.collect.Maps;
import org.apache.jackrabbit.guava.common.io.Closeables;
import org.apache.jackrabbit.guava.common.io.Files;
import org.apache.jackrabbit.guava.common.util.concurrent.ListenableFutureTask;
Expand Down Expand Up @@ -273,8 +272,9 @@ public List<GarbageCollectionRepoStats> getStats() throws Exception {
// Get all the markers available
List<DataRecord> markerFiles =
((SharedDataStore) blobStore).getAllMetadataRecords(SharedStoreRecordType.MARKED_START_MARKER.getType());
Map<String, DataRecord> markers = Maps.uniqueIndex(markerFiles,
input -> input.getIdentifier().toString().substring(SharedStoreRecordType.MARKED_START_MARKER.getType().length() + 1));
Map<String, DataRecord> markers = markerFiles.stream().collect(Collectors.toUnmodifiableMap(
input -> input.getIdentifier().toString().substring(SharedStoreRecordType.MARKED_START_MARKER.getType().length() + 1),
input -> input));

// Get all the repositories registered
List<DataRecord> repoFiles =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

Expand Down Expand Up @@ -93,7 +94,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.jackrabbit.guava.common.collect.Maps;
import com.mongodb.BasicDBObject;
import com.mongodb.MongoException;
import com.mongodb.WriteConcern;
Expand Down Expand Up @@ -1523,7 +1523,7 @@ private <T extends Document> Map<UpdateOp, T> bulkUpdate(Collection<T> collectio
}

private static Map<String, UpdateOp> createMap(List<UpdateOp> updateOps) {
return Maps.uniqueIndex(updateOps, input -> input.getId());
return updateOps.stream().collect(Collectors.toMap(UpdateOp::getId, Function.identity()));
}

private <T extends Document> Map<String, T> findDocuments(Collection<T> collection, Set<String> keys) {
Expand Down

0 comments on commit 82faccf

Please sign in to comment.