Documentation ¶
Index ¶
- func AddAt[T comparable](src []T, index int, ele T) []T
- func BatchConsume[T comparable](list []T, batchSize int, consumer func([]T))
- func Contains[T comparable](list []T, ele T) bool
- func ContainsIgnoreCase(slice []string, ele string) bool
- func ContainsIgnoreCaseReturnEle(slice []string, ele string) (bool, string)
- func ConvertEle[T any, R any](ts []T, t2r func(t T) R) []R
- func Distinct[T comparable](list []T) []T
- func Page[T comparable](list []T, subSize int) [][]T
- func Remove[T comparable](src []T, ele T) []T
- func RemoveAt[T comparable](src []T, index int) []T
- type Collection
- type List
- func (my *List[E]) Add(ele E)
- func (my *List[E]) AddAll(eles []E)
- func (my *List[E]) AddAllAt(index int, eles []E)
- func (my *List[E]) AddAt(index int, ele E)
- func (my *List[E]) Contains(ele E) bool
- func (my *List[E]) ForEach(action func(t E))
- func (my *List[E]) Get(index int) E
- func (my *List[E]) IndexOf(ele E) int
- func (my *List[E]) IsEmpty() bool
- func (my *List[E]) LastIndexOf(ele E) int
- func (my *List[E]) Lists(subSize int) [][]E
- func (my *List[E]) Remove(ele E) bool
- func (my *List[E]) RemoveAll(eles []E)
- func (my *List[E]) RemoveAt(index int) bool
- func (my *List[E]) RemoveIf(predicate func(ele E) bool)
- func (my *List[E]) RetainAll(eles []E)
- func (my *List[E]) Size() int
- func (my *List[E]) Stream() streams.Stream[E]
- func (my *List[E]) ToSet() *Set[E]
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAt ¶
func AddAt[T comparable](src []T, index int, ele T) []T
func BatchConsume ¶
func BatchConsume[T comparable](list []T, batchSize int, consumer func([]T))
BatchConsume 分批处理,每batchSize一批
func Contains ¶
func Contains[T comparable](list []T, ele T) bool
func ContainsIgnoreCase ¶
func ConvertEle ¶
func Remove ¶
func Remove[T comparable](src []T, ele T) []T
func RemoveAt ¶
func RemoveAt[T comparable](src []T, index int) []T
Types ¶
type Collection ¶
type Collection[E comparable] interface { // Add 向集合中添加一个元素ele Add(ele E) // Remove 移除集合中的一个元素ele Remove(ele E) bool // Size 返回集合的长度 Size() int // Contains 判断集合中是否包含元素ele Contains(ele E) bool // IsEmpty 判断集合是否为空集合 IsEmpty() bool }
type List ¶
type List[E comparable] []E
List 切片的别名
func (*List[E]) LastIndexOf ¶
LastIndexOf 返回ele对应切片最后一个元素的索引下标,没有则返回-1
type Set ¶
type Set[E comparable] map[E]struct{}
func OfSet ¶
func OfSet[E comparable](set *map[E]struct{}) *Set[E]
func OfSet4Arr ¶
func OfSet4Arr[E comparable](arr []E) *Set[E]
Click to show internal directories.
Click to hide internal directories.