mapx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

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

Keys returns the keys of the map m as a slice. The keys are in an undefined order. The map m must be of type map[T]V, where T is comparable, or the function panics. The function returns a slice of type []T.

func KeysEqual

func KeysEqual[T comparable, V any](m1, m2 map[T]V) bool

MapsEqual returns true if both maps have the same keys and corresponding values, and false otherwise.

Maps of type map[T]V are considered equal if they have the same number of elements and each element in m1 is in m2 with the same value, and vice versa. The order of the elements is not significant.

Both m1 and m2 must be of type map[T]V, or the function panics. The function returns a bool.

func KeysFunc

func KeysFunc[T comparable, V any](m map[T]V, f func(k T) (T, bool)) []T

func NewConMap

func NewConMap[K comparable, V any](cap int) *conMap[K, V]

func Range

func Range[K comparable, V any](m map[K]V, f func(k K, v V) bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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