Documentation ¶
Index ¶
- type IList
- type List
- func (list *List[V]) Add(items ...V)
- func (list *List[V]) AddConf(cond func(index int, item V) bool, items ...V)
- func (list *List[V]) At(index int) (result V)
- func (list *List[V]) Clear()
- func (list *List[V]) Clone() *List[V]
- func (list *List[V]) Contains(item V) bool
- func (list *List[V]) ContainsCond(cond func(index int, item V) bool) bool
- func (list *List[V]) CountCond(cond func(index int, item V) bool) int
- func (list *List[V]) Dispose()
- func (list *List[V]) Every(cond func(index int, item V) bool) bool
- func (list *List[V]) Filter(cond func(index int, item V) bool) *List[V]
- func (list *List[V]) First(cond func(index int, item V) bool) (val V, has bool)
- func (list *List[V]) ForRange(handler func(index int, item V) error)
- func (list *List[V]) ForRangeFromLast(handler func(index int, item V) error)
- func (list *List[V]) GroupByCount(count int) (r []*List[V])
- func (list *List[V]) GroupByCustomKey(getKey func(item V) string) map[string]*List[V]
- func (list *List[V]) IndexOf(item V) int
- func (list *List[V]) IndexOfConf(cond func(index int, item V) bool) int
- func (list *List[V]) Insert(i int, item V)
- func (list *List[V]) Last(cond func(index int, item V) bool) (result V, has bool)
- func (list *List[V]) Length() int
- func (list *List[V]) Pop() V
- func (list *List[V]) Push(item V)
- func (list *List[V]) PushList(val IList[V])
- func (list *List[V]) Remove(item V)
- func (list *List[V]) RemoveAt(i int)
- func (list *List[V]) Replace(i int, item V)
- func (list *List[V]) Reverse()
- func (list *List[V]) Self() *List[V]
- func (list *List[V]) Set(index int, val V)
- func (list *List[V]) SetList(val []V)
- func (list *List[V]) Shift() V
- func (list *List[V]) Slice() []V
- func (list *List[V]) Sort(compare func(a, b V) int)
- func (list *List[V]) Union(a IList[V]) *List[V]
- func (list *List[V]) UnionByCustomKey(a IList[V], getKey func(item V) string) *List[V]
- func (list *List[V]) Unique() *List[V]
- func (list *List[V]) UniqueByCustomKey(getKey func(item V) string) *List[V]
- func (list *List[V]) Unshift(item V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IList ¶
type IList[V comparable] interface { Add(items ...V) AddConf(cond func(index int, item V) bool, items ...V) Set(index int, val V) SetList(val []V) At(index int) V Clear() Dispose() Clone() *List[V] Contains(item V) bool ContainsCond(cond func(index int, item V) bool) bool CountCond(cond func(index int, item V) bool) int Every(cond func(index int, item V) bool) bool First(cond func(index int, item V) bool) (val V, has bool) Filter(cond func(index int, item V) bool) *List[V] ForRange(handler func(index int, item V) error) IndexOfConf(cond func(index int, item V) bool) int IndexOf(item V) int Last(cond func(index int, item V) bool) (val V, has bool) Length() int Pop() V Push(item V) PushList(val IList[V]) Remove(item V) RemoveAt(i int) Replace(i int, item V) Reverse() Shift() V Slice() []V Self() *List[V] Sort(compare func(a, b V) int) Unshift(item V) Unique() *List[V] UniqueByCustomKey(getKey func(item V) string) *List[V] Union(a IList[V]) *List[V] UnionByCustomKey(a IList[V], getKey func(a V) string) *List[V] GroupByCount(count int) (r []*List[V]) GroupByCustomKey(getKey func(item V) string) map[string]*List[V] }
type List ¶
type List[V comparable] struct { // contains filtered or unexported fields }
func NewList ¶
func NewList[V comparable]() (obj *List[V])
func (*List[V]) ContainsCond ¶
func (*List[V]) ForRangeFromLast ¶
从最后往前开始遍历 如果返回错误,迭代终止
func (*List[V]) GroupByCount ¶
GroupByCount 按指定数量分组
func (*List[V]) GroupByCustomKey ¶
func (*List[V]) IndexOfConf ¶
返回符合条件的项的索引
func (*List[V]) UnionByCustomKey ¶
UnionByCustomKey 并集
func (*List[V]) UniqueByCustomKey ¶
UniqueByCustomKey 去重操作, 返回去重后的数组 自定义键值
Click to show internal directories.
Click to hide internal directories.