ds

package
v1.0.0-dev.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderedMap

type OrderedMap[T comparable, V any] struct {
	// contains filtered or unexported fields
}

OrderedMap is a map with a deterministic iteration order this datastructure is thread-safe

func NewOrderedMap

func NewOrderedMap[T comparable, V any]() *OrderedMap[T, V]

NewOrderedMap returns a new OrderedMap

func (*OrderedMap[T, V]) Delete

func (m *OrderedMap[T, V]) Delete(key T)

Delete removes a key-value pair from the map

func (*OrderedMap[T, V]) Get

func (m *OrderedMap[T, V]) Get(key T) (V, bool)

Get returns the value for a given key

func (*OrderedMap[T, V]) Has

func (m *OrderedMap[T, V]) Has(key T) bool

Has returns true if the map contains the given key

func (*OrderedMap[T, V]) Keys

func (m *OrderedMap[T, V]) Keys() []T

Keys returns all keys in the map

func (*OrderedMap[T, V]) Len

func (m *OrderedMap[T, V]) Len() int

Len returns a number of the map

func (*OrderedMap[T, V]) Put

func (m *OrderedMap[T, V]) Put(key T, val V)

Put adds a key-value pair to the map

func (*OrderedMap[T, V]) Values

func (m *OrderedMap[T, V]) Values() []V

Values returns all values in the map

Jump to

Keyboard shortcuts

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