MCPcopy Create free account
hub / github.com/Monibuca/engine / Unshift

Method Unshift

util/list.go:108–118  ·  view source on GitHub ↗
(item *ListItem[T])

Source from the content-addressed store, hash-verified

106}
107
108func (p *List[T]) Unshift(item *ListItem[T]) {
109 if item.list != nil {
110 panic("item already in list")
111 }
112 if p.Length == 0 {
113 p.Next = &p.ListItem
114 p.Pre = &p.ListItem
115 p.ListItem.list = p
116 }
117 p.Next.InsertBefore(item)
118}
119
120func (p *List[T]) ShiftValue() T {
121 return p.Shift().Value

Callers 1

UnshiftValueMethod · 0.95

Calls 1

InsertBeforeMethod · 0.80

Tested by

no test coverage detected