slices

package
v0.0.0-...-2189692 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch(arr []def.CmpKey, x def.CmpKey) int

BinarySearch 二分查找

func Contains

func Contains(arr interface{}, sub interface{}) (bool, error)

func DiffUint64

func DiffUint64(a, b []uint64) []uint64

func Difference

func Difference(a []uint64, b []uint64) []uint64

func In

func In(a uint64, b []uint64) bool

func Intersection

func Intersection(a []uint64, b []uint64) []uint64

func IsCoincide

func IsCoincide(s1, s2 []def.CmpKey) bool

没有泛型,范例,实际需根据不同类型各写一遍,用CmpKey,基本类型又用不了,go需要能给基本类型实现方法不能给外部类型实现方法

func OrderArrayIntersection

func OrderArrayIntersection(a []uint64, b []uint64) []uint64

func RemoveDuplicates

func RemoveDuplicates(s []int) []int

func Sort

func Sort(s []int)

func StringContains

func StringContains(arr []string, sub string) bool

func Union

func Union(a []uint64, b []uint64) []uint64

Types

type Equal

type Equal interface {
	IsEqual(interface{}) bool
}

type IntSlice

type IntSlice struct {
	// contains filtered or unexported fields
}

func (*IntSlice) Len

func (p *IntSlice) Len() int

func (*IntSlice) Less

func (p *IntSlice) Less(i, j int) bool

func (*IntSlice) Sort

func (p *IntSlice) Sort()

Sort is a convenience method.

func (*IntSlice) Swap

func (p *IntSlice) Swap(i, j int)

type Less

type Less interface {
	Less(interface{}) bool
}

Jump to

Keyboard shortcuts

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