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 Map
- func (my *Map[K, V]) ContainsKey(key K) bool
- func (my *Map[K, V]) Entries() []MapNode[K, V]
- func (my *Map[K, V]) ForEach(action func(key K, val V))
- func (my *Map[K, V]) Get(key K) (V, bool)
- func (my *Map[K, V]) IsEmpty() bool
- func (my *Map[K, V]) Keys() []K
- func (my *Map[K, V]) Put(key K, val V)
- func (my *Map[K, V]) Remove(key K)
- func (my *Map[K, V]) Size() int
- func (my *Map[K, V]) Stream() streams.Stream[MapNode[K, V]]
- func (my *Map[K, V]) Values() []V
- type MapNode
- 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 // Stream 转为streams.Stream[T]接口 Stream() streams.Stream[E] // ForEach for循环 ForEach(f func(e E)) }
type List ¶
type List[E comparable] []E
List 切片的别名
func NewList4Set ¶
func NewList4Set[E comparable](keyMap map[E]struct{}) *List[E]
NewList4Set 根据keyMap创建*List[E]
func NewListWithCap ¶
func NewListWithCap[E comparable](cap int) *List[E]
NewListWithCap 创建list集合, 可设置 cap容量
func (*List[E]) LastIndexOf ¶
LastIndexOf 返回ele对应切片最后一个元素的索引下标,没有则返回-1
type Map ¶
type Map[K comparable, V any] map[K]V
func NewMap ¶
func NewMap[K comparable, V any]() *Map[K, V]
func NewMapWithCap ¶
func NewMapWithCap[K comparable, V any](cap int) *Map[K, V]
func OfMap ¶
func OfMap[K comparable, V any](m map[K]V) *Map[K, V]
func (*Map[K, V]) ContainsKey ¶
type MapNode ¶
type MapNode[K comparable, V any] struct { Key K Value V }
type Set ¶
type Set[E comparable] map[E]struct{}
func NewSet4Slice ¶
func NewSet4Slice[E comparable](slice []E) *Set[E]
func NewSetWithCap ¶
func NewSetWithCap[E comparable](cap int) *Set[E]
NewSetWithCap 创建一个set集合, 可设置 cap容量
func OfSet ¶
func OfSet[E comparable](keyMap map[E]struct{}) *Set[E]
Click to show internal directories.
Click to hide internal directories.