// findPrefixMatchNodes finds all matched nodes in the trie.
// The key of each node is a prefix of the input `key`.
findPrefixMatchNodes finds all matched nodes in the trie.
The key of each node is a prefix of the input `key`.
// findPrefixMatchNodes finds all matched nodes in the trie . // The key of each node is a prefix of the input ` key ` .
func (t *Trie) findPrefixMatchNodes(key string) ([]*trieNode, bool) {
	found := false
	node := t.root
	if node == nil {
		return nil, false
	}
	if t.size <= 0 {
		return nil, false
	}
	nodes := make([]*trieNode, 0, t.size)
	for _, r := range []rune(key) {
		n, ok := node.children[r]
		if !ok {
			break
		}
		t, ok := n.children[nul]
		if ok && t.term {
			nodes = append(nodes, t)
			found = true
		}
		node = n
	}
	if found {
		return nodes, true
	}
	return nil, false
}
func ( t * Trie ) findPrefixMatchNodes ( key string ) ( [ ] * trieNode , bool ) { found := false node := t . root if node == nil { return nil , false } if t . size <= 0 { return nil , false } nodes := make ( [ ] * trieNode , 0 , t . size ) for _ , r := range [ ] rune ( key ) { n , ok := node . children [ r ] if ! ok { break } t , ok := n . children [ nul ] if ok && t . term { nodes = append ( nodes , t ) found = true } node = n } if found { return nodes , true } return nil , false }
findPrefixMatchNodes finds all matched nodes in the trie.
findPrefixMatchNodes finds all matched nodes in the trie .