Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/584#discussion_r205749086
  
    --- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
    @@ -478,7 +478,10 @@ public void createNode(final String path, byte data[], 
List<ACL> acl,
                     HashSet<String> list = ephemerals.get(ephemeralOwner);
                     if (list == null) {
                         list = new HashSet<String>();
    -                    ephemerals.put(ephemeralOwner, list);
    +                    HashSet<String> _list;
    --- End diff --
    
    You can use `computeIfAbsent()` like this:
    ```java
    HashSet<String> list = ephemerals.computeIfAbsent(ephemeralOwner, k -> new 
HashSet<String>());
    ```


---

Reply via email to