docs: public static TreeNode build(List<Class<?>> choices, String rootpkg) {
      MutableTreeNode root = new PackageNode(rootpkg, rootpkg);
      HashMap<String, MutableTreeNode> lookup = new HashMap<>();
      if(rootpkg != null) {
        lookup.put(rootpkg, root);
      }
      lookup.put("de.lmu.ifi.dbs.elki", root);
      lookup.put("", root);
  
      // Use the shorthand version of class names.
      String prefix = rootpkg != null ? rootpkg + "." : null;
  
      Class<?>[] choic = choices.toArray(new Class<?>[choices.size()]);
      Arrays.sort(choic, ELKIServiceScanner.SORT_BY_PRIORITY);
      for(Class<?> impl : choic) {
        String name = impl.getName();
        name = (prefix != null && name.startsWith(prefix)) ? name.substring(prefix.length()) : name;
        int plen = (impl.getPackage() != null) ? impl.getPackage().getName().length() + 1 : 0;
        MutableTreeNode c = new ClassNode(impl.getName().substring(plen), name);
  
        MutableTreeNode p = null;
        int l = name.lastIndexOf('.');
        while(p == null) {
          if(l < 0) {
            p = root;
            break;
          }
          String pname = name.substring(0, l);
          p = lookup.get(pname);
          if(p != null) {
            break;
          }
          l = pname.lastIndexOf('.');
          MutableTreeNode tmp = new PackageNode(l >= 0 ? pname.substring(l + 1) : pname, pname);
          tmp.insert(c, 0);
          c = tmp;
          lookup.put(pname, tmp);
          name = pname;
        }
        p.insert(c, p.getChildCount());
      }
      // Simplify tree, except for root node
      for(int i = 0; i < root.getChildCount(); i++) {
        MutableTreeNode c = (MutableTreeNode) root.getChildAt(i);
        MutableTreeNode c2 = simplifyTree(c, null);
        if(c != c2) {
          root.remove(i);
          root.insert(c2, i);
        }
      }
      return root;
    }