collectionutil

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[E comparable](slice []E, elem E) bool

func CopyMap

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

func FlattenUnique

func FlattenUnique[E comparable](slices ...[]E) []E

FlattenUnique appends each unique item in each list, in the order in which it first appears.

Examples:

  • FlattenUnique([]int{1, 2, 3}, []int{4, 3, 4}) => []int{1, 2, 3, 4}
  • FlattenUnique([]int{1, 2, 2}, []int{3, 4}) => []int{1, 2, 3, 4}

func GetOneEntry

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

GetOneEntry gets an entry from the given map. If the map contains multiple entries, it's undefined which this returns. If the map is empty, this will return the zero value for both the key and map.

func Keys

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

Types

type ExtendingMap

type ExtendingMap[K comparable, V any] map[K]V

func Extend

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

func (ExtendingMap[K, V]) Into

func (source ExtendingMap[K, V]) Into(target map[K]V)

Jump to

Keyboard shortcuts

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