User Tools

Site Tools


snippets:golang:containers:doublelist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
snippets:golang:containers:doublelist [2018/03/20 13:54] allsparksnippets:golang:containers:doublelist [2018/03/20 16:52] (current) allspark
Line 44: Line 44:
  list.tail = item  list.tail = item
  
 +}
 +
 +func (list *MyList) Delete(item *MyListElement) {
 + if list.head == item && list.tail == item && item.prev == nil && item.next == nil {
 + list.head = nil
 + list.tail = nil
 + return
 + }
 +
 + item.prev = item.next
 + item.next = item.prev
 } }
  
Line 71: Line 82:
  
  fmt.Println(list.Count())  fmt.Println(list.Count())
- 
 } }
- 
 ``` ```
snippets/golang/containers/doublelist.1521550461.txt.gz · Last modified: by allspark