MCPcopy
hub / github.com/cornelk/hashmap / insertAt

Method insertAt

list.go:114–127  ·  view source on GitHub ↗
(element, left, right *ListElement[Key, Value])

Source from the content-addressed store, hash-verified

112}
113
114func (l *List[Key, Value]) insertAt(element, left, right *ListElement[Key, Value]) bool {
115 if left == nil {
116 left = l.head
117 }
118
119 element.next.Store(right)
120
121 if !left.next.CompareAndSwap(right, element) {
122 return false // item was modified concurrently
123 }
124
125 l.count.Add(1)
126 return true
127}

Callers 2

AddMethod · 0.95
AddOrUpdateMethod · 0.95

Calls 1

AddMethod · 0.80

Tested by

no test coverage detected