Documentation
¶
Overview ¶
Package collections provides generic collection utility functions.
Index ¶
- func Keys[K comparable, V any](m map[K]V) []K
- func ListContainsElement[T comparable](list []T, element T) bool
- func ListIntersection[T comparable](a, b []T) []T
- func MapJoin[K comparable, V any](m map[K]V, argSep string, valSep string) string
- func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListContainsElement ¶
func ListContainsElement[T comparable](list []T, element T) bool
ListContainsElement returns true if the list contains the given element.
func ListIntersection ¶
func ListIntersection[T comparable](a, b []T) []T
ListIntersection returns elements that are in both lists.
func MapJoin ¶
func MapJoin[K comparable, V any](m map[K]V, argSep string, valSep string) string
MapJoin joins a map into a string with the given argument and value separators. Example: MapJoin({"a": "1", "b": "2"}, ",", "=") → "a=1,b=2"
func MergeMaps ¶
func MergeMaps[K comparable, V any](maps ...map[K]V) map[K]V
MergeMaps merges multiple maps into one. Later maps override earlier ones.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.