code: public List<TrieNode> search(String path) {
      List<TrieNode> terminal = new ArrayList<>();
      TrieNode current = this;
      if (current.mIsTerminal) {
        terminal.add(current);
      }
      for (String component : path.split("/")) {
        if (current.mChildren.containsKey(component)) {
          current = current.mChildren.get(component);
          if (current.mIsTerminal) {
            terminal.add(current);
          }
        } else {
          break;
        }
      }
      return terminal;
    }
docs: Traverses the trie along the path components until the traversal cannot proceed any more.
  
  @param path the target path
  @return the terminal nodes sorted by the time they are visited