Number of (path, value) pairs currently in the trie. A path with three values contributes three to the size.
Remove every entry from the trie. Restores a never-used state.
Return the (possibly empty) bucket of values stored at exactly this path. Returns an array, never null. Order is insertion order (Set iteration order).
Walk the trie and return every value at a path matching pattern.
Pattern syntax matches PathPatternApi: *, **, ?.
The walk avoids materializing the full path set — ** triggers a
subtree descent, plain literal segments do an O(1) child lookup,
and only * / ? segments fan out across siblings.
Order of results is unspecified across siblings (Map iteration order is insertion order in practice, but callers should not rely on it).
Insert value under path. Multiple values can share a path.
No-op if the (path, value) pair is already present.
Test helper. Returns true when the trie has been fully pruned (no children at any depth, no terminal values).
Return the values stored at the longest path that is a prefix of
path (segment-wise) and carries values — the nearest-ancestor
(or exact) match. Walks segment-by-segment from the root,
remembering the deepest node along the way that owns a value
bucket. Returns [] when no ancestor-or-exact path has values.
Reuses the same /-split segment discipline as the other walks —
it introduces no parallel path syntax and carries no glob
semantics (matching is exact-per-segment). O(depth) literal
descent.
The path string of the longest value-carrying prefix of path, or
null when none. Companion to longestPrefix for callers
that need the matched prefix itself (e.g. provenance rendering).
Remove value from path. No-op if not present. Prunes empty
branches so a never-inserted state is restored when the last
value at a path is removed.
Path-keyed trie with exact lookup and glob walk.
Paths are split on
/into segments; each segment becomes a level. Multiple values may share a path (aSet<T>lives at each terminal node). On removal the trie prunes any node that becomes empty (no children, no values), so a balancedinsert/removepair leaves the trie identical to its never-inserted state.Glob walk delegates to PathPatternApi.compile so syntax stays consistent with the rest of the codebase. The walk is segment-aware where possible —
**segments enable a full subtree descent, while*and?segments stay within one level — so the walker doesn't have to enumerate every leaf.