rishabhdaim commented on code in PR #2408:
URL: https://github.com/apache/jackrabbit-oak/pull/2408#discussion_r2236375785


##########
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/SharedDataStoreUtils.java:
##########
@@ -63,10 +65,24 @@ public static DataRecord getEarliestRecord(List<DataRecord> 
recs) {
      */
     public static Set<String> refsNotAvailableFromRepos(List<DataRecord> repos,
             List<DataRecord> refs) {
-        return SetUtils.difference(FluentIterable.from(repos)
-                .uniqueIndex(input -> 
SharedStoreRecordType.REPOSITORY.getIdFromName(input.getIdentifier().toString())).keySet(),
-                FluentIterable.from(refs)
-                        .index(input -> 
SharedStoreRecordType.REFERENCES.getIdFromName(input.getIdentifier().toString())).keySet());
+        return SetUtils.difference(
+                StreamUtils.toStream(
+                        FluentIterable.of(repos)).collect(
+                                Collectors.toMap(
+                                        input -> 
SharedStoreRecordType.REPOSITORY.getIdFromName(input.getIdentifier().toString()),
+                                        e -> e,
+                                        (oldValue, newValue) -> {
+                                            throw new 
IllegalArgumentException("Duplicate key found: " + 
SharedStoreRecordType.REPOSITORY.getIdFromName(newValue.getIdentifier().toString()));

Review Comment:
   This exception is thrown to mimic the original Guava behaviour.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to