Import std.collections.trie
std.collections.trie
Trie<V>: String keys and their values in a tree with a node for each prefix of the keys'
bytes, so the keys with a prefix, or the longest key a text starts with, are found by going down
the prefix alone. The keys go in the order of their bytes, which is their code points' order.
std/collections/trie.fb
Types
Trie
class
@DebugEntries Public Class Trie<V> Implements Iterable<(String, V)>, Cloneable, Defaultable
A Map from Strings that finds the keys that start with a prefix.
std/collections/trie.fb, line 45
-
A new, empty Trie.
-
How many entries it holds.
-
Adds an entry, or gives an existing
keyits new value. -
The
key's value, or Null when it isn't there. -
The
key's value, orfallbackwhen it isn't there. -
The key's value. A key that isn't there panics.
-
Gives the key a value, adding it when it isn't there.
-
Whether
keyhas an entry. -
Removes the
key's entry, and tells whether there was one. -
Takes every entry out.
-
Whether a key starts with
prefix, as every key starts with "", so an empty Trie has none. Every node but the root is on the way to a key, since Remove takes out what only its key needed. -
The keys that start with
prefix, in order, in a new array. -
The longest key that
textstarts with, or Null when none does. -
The keys, in order.
-
The values, in their keys' order.
-
A new, empty Trie.
-
A new Trie with the same entries.
-
Each key and its value, in order, for 'For key, value In trie'. Giving a key a new value while going over them is fine, but adding or removing one panics.
TrieIterator
struct
Public Struct TrieIterator<V> Implements Iterator<(String, V)>
The keys in order: the node it's at, or Null at the end, with the next of its children to go into, or -1 before its own key, and the nodes on the way down to it.
std/collections/trie.fb, line 239
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
Extends
Trie
extend
Extend Trie<V> Implements Equatable
No doc comment.
std/collections/trie.fb, line 276
-
Whether
aandbare equal.Doc from
std.core.interfaces.Equatable.Operator==.
Trie
extend
Extend Trie<V> Implements Printable
No doc comment.
std/collections/trie.fb, line 291
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
Report an issue with this page or with FutureBlitz on GitHub.