severussundar commented on a change in pull request #1306: ZOOKEEPER-3415: 
Convert internal logic to use streams
URL: https://github.com/apache/zookeeper/pull/1306#discussion_r404595665
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java
 ##########
 @@ -241,13 +240,14 @@ public int getEphemeralsCount() {
      */
     public long approximateDataSize() {
         long result = 0;
-        for (Map.Entry<String, DataNode> entry : nodes.entrySet()) {
-            DataNode value = entry.getValue();
-            synchronized (value) {
-                result += getNodeSize(entry.getKey(), value.data);
-            }
-        }
-        return result;
+               
+               for (Map.Entry<String, DataNode> entry : nodes.entrySet()) { 
+                       DataNode value =entry.getValue(); 
+                       synchronized (value) { 
+                               result +=getNodeSize(entry.getKey(), 
value.data); 
+                               } 
+                       } 
+               return result;
     }
 
 
 Review comment:
   I was trying to use a stream here but couldn't come up with the correct 
approach and reverted back to the original for loop. I'll remove the extra 
indendations. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to