Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Excerpt
- // Push data into the tail of the list
- func (list *List) Push(data interface{}) {
- node := node{data: data, next: nil, prev: nil}
- if list.head == nil {
- list.head = &node
- list.tail = &node
- } else {
- list.tail.next = &node
- node.prev = list.tail
- list.tail = &node
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement