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


##########
oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/binary/fixtures/nodestore/DocumentMemoryNodeStoreFixture.java:
##########
@@ -87,11 +86,11 @@ public NodeStore createNodeStore() {
 
             // track all main components
             if (dataStore != null) {
-                components.put(nodeStore, DataStore.class.getName(), 
dataStore);
-                components.put(nodeStore, DataStore.class.getName() + 
":folder", dataStoreFolder);
+                components.computeIfAbsent(nodeStore, k -> new 
LinkedHashMap<>()).put(DataStore.class.getName(), dataStore);
+                components.computeIfAbsent(nodeStore, k -> new 
LinkedHashMap<>()).put(DataStore.class.getName() + ":folder", dataStoreFolder);
             }

Review Comment:
   No, the new code works as follows:
   
   `components.computeIfAbsent(nodeStore, k -> new LinkedHashMap<>())`
   
   In case the value associated with `nodeStore` key is null, then create an 
empty `LinkedHashMap`
   
   and then `.put(DataStore.class.getName(), dataStore);`
   
   would put above values into that newly created `LinkedHashMap`.
   
   So essentially it is creating an store which is equivalent to above like: 
`nodeStore` is row name and values added into that are cells.
   



-- 
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