Last active
June 15, 2020 01:01
-
-
Save pacuna/4e0db38b62a8f46bd986e4ce2e2161d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (l *list) Remove(item []byte) bool { | |
var pred, curr *node | |
key, _ := hashstructure.Hash(item, nil) | |
pred = l.head | |
curr = pred.next | |
for curr.key < key { | |
pred = curr | |
curr = curr.next | |
} | |
if key == curr.key { | |
pred.next = curr.next | |
l.size-- | |
return true | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment