Fixed prev link for items

Changed the order of updates of pointers for new items of the list to make Prev() function works property.
pull/9/head
Gregorio Galante 6 years ago committed by GitHub
parent 9e9b987737
commit be6879dec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,8 +31,8 @@ func Insert(value interface{}, list *List) *List {
list.head = newItem
list.last = newItem
} else {
list.head = newItem
list.head.prev = newItem
list.head = newItem
list.last.next = newItem
}

Loading…
Cancel
Save