android-components / mozilla.components.browser.engine.system.matcher / Trie

# Trie

`open class Trie` (source)

Simple implementation of a Trie, used for indexing URLs.

### Constructors

<init> | `Trie(character: Char, parent: Trie?)` Simple implementation of a Trie, used for indexing URLs.

### Properties

children | `val children: SparseArray<Trie>`

### Functions

createNode | `open fun createNode(character: Char, parent: Trie): Trie` Creates a new node for the provided character and parent node.
findNode | `fun findNode(string: String): Trie?` `fun findNode(string: ReversibleString): Trie?` Finds the node corresponding to the provided string.
put | `fun put(string: String): Trie` `fun put(string: ReversibleString): Trie` Adds new nodes (recursively) for all chars in the provided string. `fun put(character: Char): Trie` Adds a new node for the provided character if none exists.

### Companion Object Functions

createRootNode | `fun createRootNode(): Trie` Creates a new root node.