class RadixTree {

  public List<RadixNode<T>> getLongestPrefixPath(String path) {
    RadixNode n = root;
    Path p = Paths.get(path);
    int level = 0;
    List<RadixNode<T>> result = new ArrayList<>();
    result.add(root);
    while (level < p.getNameCount()) {
      HashMap<String, RadixNode> children = n.getChildren();
      if (children.isEmpty()) {
        break;
      }
      String component = p.getName(level).toString();
      if (children.containsKey(component)) {
        n = children.get(component);
        result.add(n);
        level++;
      } else {
        break;
      }
    }
    return result;
  }

  public  RadixTree();

}