private TreeMap<Long,String> orderedChildren(Watcher watcher) throws KeeperException, InterruptedException {
  TreeMap<Long,String> orderedChildren=new TreeMap<>();
  List<String> childNames=zookeeper.getChildren(dir,watcher,true);
  for (  String childName : childNames) {
    try {
      if (!childName.regionMatches(0,prefix,0,prefix.length())) {
        LOG.debug("Found child node with improper name: " + childName);
        continue;
      }
      String suffix=childName.substring(prefix.length());
      Long childId=new Long(suffix);
      orderedChildren.put(childId,childName);
    }
 catch (    NumberFormatException e) {
      LOG.warn("Found child node with improper format : " + childName + " "+ e,e);
    }
  }
  return orderedChildren;
}

private TreeMap < Long , String > orderedChildren ( Watcher watcher ) throws KeeperException , InterruptedException { TreeMap < Long , String > orderedChildren = new TreeMap < > ( ) ; List < String > childNames = zookeeper . getChildren ( dir , watcher , true ) ; for ( String childName : childNames ) { try { if ( ! childName . regionMatches ( 0 , prefix , 0 , prefix . length ( ) ) ) { LOG . debug ( "Found child node with improper name: " + childName ) ; continue ; } String suffix = childName . substring ( prefix . length ( ) ) ; Long childId = new Long ( suffix ) ; orderedChildren . put ( childId , childName ) ; } catch ( NumberFormatException e ) { LOG . warn ( "Found child node with improper format : " + childName + " " + e , e ) ; } } return orderedChildren ; }
returns a map of the children , ordered by id .
