docs: private static void groupViewsByDirectoriesAndGetMeasures(
        Set<View> views, TreeNode root, Map<String, Measure> measures, Set<View> cachedViews) {
      for (View view : views) {
        if (cachedViews.contains(view)) {
          continue;
        }
        cachedViews.add(view);
  
        List<String> dirs = PATH_SPLITTER.splitToList(view.getName().asString());
        TreeNode node = root;
        for (int i = 0; i < dirs.size(); i++) {
          if (node == null) {
            break; // Should never happen. Work around the nullness checker.
          }
          String dir = dirs.get(i);
          if ("".equals(dir) && i == 0) {
            continue; // In case view name starts with a '/'.
          }
          node.views++;
          if (i != dirs.size() - 1) { // Non-leaf node (directory node)
            node.children.putIfAbsent(dir, new TreeNode());
            node = node.children.get(dir);
          } else { // Leaf node (view node)
            node.children.putIfAbsent(dir, new TreeNode(view.getName()));
          }
        }
  
        Measure measure = view.getMeasure();
        measures.putIfAbsent(measure.getName(), measure);
      }
    }