MCPcopy Create free account
hub / github.com/benbjohnson/immutable / newSortedMapBranchNode

Function newSortedMapBranchNode

immutable.go:1774–1785  ·  view source on GitHub ↗

newSortedMapBranchNode returns a new branch node with the given child nodes.

(children ...sortedMapNode[K, V])

Source from the content-addressed store, hash-verified

1772
1773// newSortedMapBranchNode returns a new branch node with the given child nodes.
1774func newSortedMapBranchNode[K, V any](children ...sortedMapNode[K, V]) *sortedMapBranchNode[K, V] {
1775 // Fetch min keys for every child.
1776 elems := make([]sortedMapBranchElem[K, V], len(children))
1777 for i, child := range children {
1778 elems[i] = sortedMapBranchElem[K, V]{
1779 key: child.minKey(),
1780 node: child,
1781 }
1782 }
1783
1784 return &sortedMapBranchNode[K, V]{elems: elems}
1785}
1786
1787// minKey returns the lowest key stored in this node's tree.
1788func (n *sortedMapBranchNode[K, V]) minKey() K {

Callers 2

setMethod · 0.85

Calls 1

minKeyMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…