ordered

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ordered provides ordered data structure.

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. Iter iterates over the map using the same order in which the keys have been added.

func NewMap

func NewMap[K comparable, V any]() *Map[K, V]

NewMap returns a new ordered map.

func (*Map[K, V]) Clone

func (m *Map[K, V]) Clone() *Map[K, V]

Clone creates a new map with the same keys and values. This is a shallow clone.

func (*Map[K, V]) Iter

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

Iter returns an iterator to range over the elements of the map.

func (*Map[K, V]) Keys

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

Keys returns an iterator to range over the keys of the map.

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(k K) (V, bool)

Load returns a value given a key.

func (*Map[K, V]) Size

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

Size returns the number of elements in the map.

func (*Map[K, V]) Store

func (m *Map[K, V]) Store(k K, v V)

Store a key,value pair.

func (*Map[K, V]) Values

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

Values returns an iterator to range over the values of the map.

Jump to

Keyboard shortcuts

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