glist

并发安全双向列表。

使用场景

并发安全场景下的链表操作,也可以关闭并发安全性当做普通的链表来使用。

使用方式

  1. import "gitee.com/johng/gf/g/container/glist"

方法列表godoc.org/github.com/johng-cn/gf/g/container/glist

  1. type SafeList
  2. func New(safe ...bool) *List
  3. func (this *List) Back() *list.Element
  4. func (this *List) BackAll() []interface{}
  5. func (this *List) BackItem() interface{}
  6. func (this *List) BatchPopBack(max int) []interface{}
  7. func (this *List) BatchPopFront(max int) []interface{}
  8. func (this *List) BatchPushFront(vs []interface{})
  9. func (this *List) Front() *list.Element
  10. func (this *List) FrontAll() []interface{}
  11. func (this *List) FrontItem() interface{}
  12. func (this *List) InsertAfter(v interface{}, mark *list.Element) *list.Element
  13. func (this *List) InsertBefore(v interface{}, mark *list.Element) *list.Element
  14. func (this *List) Len() int
  15. func (this *List) PopBack() interface{}
  16. func (this *List) PopBackAll() []interface{}
  17. func (this *List) PopFront() interface{}
  18. func (this *List) PopFrontAll() []interface{}
  19. func (this *List) PushBack(v interface{}) *list.Element
  20. func (this *List) PushFront(v interface{}) *list.Element
  21. func (this *List) Remove(e *list.Element) interface{}
  22. func (this *List) RemoveAll()

由于链表本身是比较简单的数据结构,这里便不再举例说明,通过方法名称即可知其意。