oleiade / lane

Generic PriorityQueues, Queues, Stacks, and Deque data structures for Go
https://pkg.go.dev/github.com/oleiade/lane#pkg-types
MIT License
877 stars 76 forks source link

add method .Empty() for pqueue #14

Closed EricYT closed 8 years ago

EricYT commented 8 years ago

A method check the pqueue is empty

oleiade commented 8 years ago

Hey @EricYT

What's the motivation for an Empty method? What would be the added value compared to len(myQueue.Size()) == 0 ?

EricYT commented 8 years ago

Hey @oleiade Deque has a method .Empty(). So pqueue should has a method .Empty() let the interface pure.If the code use .Empty() some places, other location use len(xx) == 0.Ugly aren't ?

oleiade commented 8 years ago

Hehe my bad. Thanks for the PR @EricYT and sorry for the awful delay!