1 Star 0 Fork 0

rocket-booster/go-stl-deque

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
interface.go 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
gengbing 提交于 2021-01-04 17:47 . add DequeueManyWithBuffer
package deque
type Elem = interface{}
// Deque is a fast double-ended queue.
type Deque interface {
// PushBack adds a new value v at the back of Deque.
PushBack(v Elem)
// PushFront adds a new value v at the front of Deque.
PushFront(v Elem)
// PopBack removes a value from the back of Deque and returns
// the removed value or nil if the Deque is empty.
PopBack() Elem
// PopFront removes a value from the front of Deque and returns
// the removed value or nil if the Deque is empty.
PopFront() Elem
// Back returns the last value of Deque or nil if the Deque is empty.
Back() Elem
// Front returns the first value of Deque or nil if the Deque is empty.
Front() Elem
// Empty returns whether Deque is empty.
Empty() bool
// Len returns the number of values in Deque.
Len() int
// Enqueue is an alias of PushBack.
Enqueue(v Elem)
// Dequeue is an alias of PopFront.
Dequeue() Elem
// DequeueMany removes a number of values from the front of Deque and
// returns the removed values or nil if the Deque is empty.
// If max <= 0, DequeueMany removes and returns all the values in Deque.
DequeueMany(max int) []Elem
// DequeueManyWithBuffer is similar to DequeueMany except that it uses
// buf to store the removed values as long as it has enough space.
DequeueManyWithBuffer(max int, buf []Elem) []Elem
// Range iterates all of the values in Deque.
Range(f func(i int, v Elem) bool)
// Peek returns the value at idx
Peek(idx int) Elem
// Replace replaces the value at idx
Replace(idx int, v Elem)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rocket-booster/go-stl-deque.git
git@gitee.com:rocket-booster/go-stl-deque.git
rocket-booster
go-stl-deque
go-stl-deque
master

搜索帮助