ordered

package
v0.0.0-...-2d567a2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 2 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 comparable, V any] struct {
	// contains filtered or unexported fields
}

Map is an ordered map of values.

The zero value of a Map is an empty map ready to use.

func (*Map[K, V]) All

func (m *Map[K, V]) All() iter.Seq2[K, V]

All returns an iterator over all items in the map in the order they were added.

Modifying the map during iteration can result in some members not being visited.

func (*Map[K, V]) At

func (m *Map[K, V]) At(idx int) (V, bool)

At returns the value at the given position.

func (*Map[K, V]) Contains

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

Contains returns whether the given key exists in the map.

func (*Map[K, V]) Delete

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

Delete deletes the value for the given key.

func (*Map[K, V]) Get

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

Get returns the value with the given key.

func (*Map[K, V]) Len

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

Len returns the number of items in the map.

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(key K, value V)

Set sets the value for the given key in the map.

If the key already exists in the map, the value replaces the existing value, keeping the position of the old value.

Jump to

Keyboard shortcuts

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