collections

package
v0.50.11 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](l []T, target T) bool

Contains l 中是否包含 target

func Difference

func Difference[T comparable](a, b []T) []T

Difference 求差集 返回在 a 中,但是不在 b 中的集合

func Join

func Join[T constraints.Ordered](l []T, sep string) string

Join [1,2,3] -> 1_2_3

func Keys

func Keys[K comparable, V any](m map[K]V) []K

Keys {1:a, 2:b} -> [1, 2]

func MaxCount

func MaxCount[T comparable](a, b []T) int

func Sum

func Sum[T constraints.Integer | constraints.Float](l []T) T

Sum 计算总数 [1,2,3] -> 6

func Unique

func Unique[T comparable](l []T) []T

Unique set [1,1,2,3,3] -> [1,2,3]

func Values

func Values[K comparable, V any](m map[K]V) []V

Values {1:a, 2:b} -> [a, b]

Types

This section is empty.

Jump to

Keyboard shortcuts

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