orderedmap

package
v1.0.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K any, V any] interface {
	Get(K) V
	GetOk(key K) (V, bool)
	Set(K, V)
	Size() int
	ContainsKey(key K) bool
	Keys() []K
	Merge(...Map[K, V]) Map[K, V]
	SortKeys(f func(x, y K) int)
	SortStableKeys(f func(x, y K) int)
	Values() []V
	Clone() Map[K, V]
	Remove(key K)
	MarshalJSON() ([]byte, error)
}

Map is a map that keeps ordering insertion.

func New

func New[K scalars, V any]() Map[K, V]

New creates a map

func NewWithConversionFunc

func NewWithConversionFunc[K any, V any, C scalars](conv func(K) C) Map[K, V]

NewWithConversionFunc creates a map using the given conversion function to convert non-comparable key type to comparable items. The conversion function must be bijective.

Jump to

Keyboard shortcuts

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