maps

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 2 Imported by: 1

README

maps

Generic operations on maps.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEntries added in v0.2.6

func FromEntries[K comparable, V any](src []Entry[K, V]) map[K]V

FromEntries creates a map from a slice of key/value tuples.

func Keys

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

Keys returns an unsorted slice of map keys.

func SortedKeys

func SortedKeys[K cmp.Ordered, V any](src map[K]V) []K

SortedKeys returns a sorted slice of map keys.

func SortedValues

func SortedValues[K comparable, V cmp.Ordered](src map[K]V) []V

SortedValues returns a sorted slice of map values.

func Values

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

Values returns an unsorted slice of map values.

Types

type Entry added in v0.2.6

type Entry[K comparable, V any] struct {
	Key K
	Val V
}

Entry is a key/value tuple representing a map entry.

func Entries added in v0.2.6

func Entries[K comparable, V any](src map[K]V) []Entry[K, V]

Entries returns an unsorted slice of map entries.

func SortedEntries added in v0.2.6

func SortedEntries[K cmp.Ordered, V any](src map[K]V) []Entry[K, V]

SortedEntries returns a slice of map entries sorted by their keys.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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