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

Method Next

list_element.go:30–47  ·  view source on GitHub ↗

Next returns the item on the right.

()

Source from the content-addressed store, hash-verified

28
29// Next returns the item on the right.
30func (e *ListElement[Key, Value]) Next() *ListElement[Key, Value] {
31 for next := e.next.Load(); next != nil; {
32 // if the next item is not deleted, return it
33 if next.deleted.Load() == 0 {
34 return next
35 }
36
37 // point current elements next to the following item
38 // after the deleted one until a non deleted or list end is found
39 following := next.Next()
40 if e.next.CompareAndSwap(next, following) {
41 next = following
42 } else {
43 next = next.Next()
44 }
45 }
46 return nil // end of the list reached
47}

Callers 15

TestListNewFunction · 0.80
GetMethod · 0.80
GetOrInsertMethod · 0.80
DelMethod · 0.80
StringMethod · 0.80
RangeMethod · 0.80
deleteElementMethod · 0.80
fillIndexItemsMethod · 0.80
FirstMethod · 0.80
DeleteMethod · 0.80
searchMethod · 0.80
BenchmarkReadHashMapUintFunction · 0.80

Calls

no outgoing calls