mylist

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelItem

func DelItem[E comparable](list []E, delE E) []E

删除掉数组中指定的元素

func Difference

func Difference[E comparable](slice1, slice2 []E) []E

求差集 slice1-并集 :取Slice的 差集部分

func Intersect

func Intersect[E comparable](slice1, slice2 []E) []E

求交集

func IsExistItem

func IsExistItem[E comparable](list []E, ele E) bool

检测数组中是否存在该元素

func RemoveDuplicItem

func RemoveDuplicItem[E comparable](list []E) []E

数组去重

func Union

func Union[E comparable](slice1, slice2 []E) []E

求并集

Types

type List

type List[E any] struct {
	// contains filtered or unexported fields
}

func NewList

func NewList[E any]() *List[E]

func NewListEx

func NewListEx[E any](capacityNum int32) *List[E]

func ToList added in v1.8.6

func ToList[F, T any](org *List[F], f func(o F) T) *List[T]

a list to b list

func (*List[E]) Append

func (l *List[E]) Append(item E)

func (*List[E]) AppendByArray

func (l *List[E]) AppendByArray(items []E)

func (*List[E]) At

func (l *List[E]) At(index int) (v E, err error)

func (*List[E]) Clear

func (l *List[E]) Clear()

func (*List[E]) First

func (l *List[E]) First() (v E, err error)

func (*List[E]) Insert

func (l *List[E]) Insert(index int, item E) error

func (*List[E]) Last

func (l *List[E]) Last() (v E, err error)

func (*List[E]) Len

func (l *List[E]) Len() int

func (*List[E]) Move

func (l *List[E]) Move(from, to int) error

func (*List[E]) PreAppend

func (l *List[E]) PreAppend(item E)

func (*List[E]) Range

func (l *List[E]) Range(f func(index int, v E))

func (*List[E]) RemoveAt

func (l *List[E]) RemoveAt(index int) error

func (*List[E]) RemoveFirst

func (l *List[E]) RemoveFirst() error

func (*List[E]) RemoveLast

func (l *List[E]) RemoveLast() error

func (*List[E]) ResetByArray

func (l *List[E]) ResetByArray(items []E)

func (*List[E]) String

func (l *List[E]) String() string

func (*List[E]) SwapItemsAt

func (l *List[E]) SwapItemsAt(idx1, idx2 int) error

func (*List[E]) TakeAll

func (l *List[E]) TakeAll() []E

func (*List[E]) TakeAt

func (l *List[E]) TakeAt(idx int) (v E, err error)

func (*List[E]) TakeFirst

func (l *List[E]) TakeFirst() (v E, err error)

func (*List[E]) TakeHeadN

func (l *List[E]) TakeHeadN(count int) []E

func (*List[E]) TakeLast

func (l *List[E]) TakeLast() (v E, err error)

func (*List[E]) ToArray

func (l *List[E]) ToArray() []E

func (*List[E]) Where added in v1.8.6

func (l *List[E]) Where(f func(index int, v E) bool) *List[E]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL