lmap

package
v0.0.0-...-157c9c8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package lmap provides helpers for the built in map type.

Note that there is also util/filter.Map which provides very powerful tools for performing filtering operations on a map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortKeys

func SortKeys[K constraints.Ordered, V any](m map[K]V) slice.Slice[K]

SortKeys is a convenience function that returns the keys sorted keys. This is equivalent to calling m.Keys(nil).Sort(slice.LT[K]()). It assumes slice.LT for sorting and a nil buffer. If either of those assumtions are not true, use Keys and Sort explicitly.

func Unique

func Unique[K comparable](s, buf []K) slice.Slice[K]

Types

type Map

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

func Iter

func Iter[K comparable, V any](in liter.Iter[K], fn func(K, int) (V, bool)) Map[K, V]

func (Map[K, V]) Keys

func (m Map[K, V]) Keys(buf slice.Slice[K]) slice.Slice[K]

func (Map[K, V]) Len

func (m Map[K, V]) Len() int

func (Map[K, V]) Pop

func (m Map[K, V]) Pop(key K) (V, bool)

func (Map[K, V]) Vals

func (m Map[K, V]) Vals(buf slice.Slice[V]) slice.Slice[V]

Jump to

Keyboard shortcuts

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