(item *ListItem[T])
| 106 | } |
| 107 | |
| 108 | func (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 | |
| 120 | func (p *List[T]) ShiftValue() T { |
| 121 | return p.Shift().Value |
no test coverage detected