shayshim commented on a change in pull request #336: [CURATOR-549] Bridge 
facade for ModeledCache and ServiceCache, etc.
URL: https://github.com/apache/curator/pull/336#discussion_r403517576
 
 

 ##########
 File path: 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java
 ##########
 @@ -121,8 +128,11 @@ public void close()
     {
         ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder();
         boolean thisIdAdded = false;
-        for ( ChildData data : cache.getCurrentData() )
+
+        Iterator<ChildData> iterator = 
cache.stream().filter(parentPathFilter(membershipPath)).iterator();
 
 Review comment:
   Not sure if it is better, just want to mention you could stay with the more 
pleasant for-each syntax by relying on `Iterable` like that:
   ```
   Iterable<ChildData> iterable = getChildDataIterable();
           for (ChildData data: iterable)
   ```
   While `getChildDataIterable` is:
   ```
   private Iterable<ChildData> getChildDataIterable() {
           Stream<ChildData> onlyMembers = 
cache.stream().filter(parentPathFilter(membershipPath));
           return onlyMembers::iterator;
       }
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to