orderedmap

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 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 OrderedMap

type OrderedMap struct {
	// contains filtered or unexported fields
}

OrderedMap represents an ordered map data structure

func New

func New() *OrderedMap

New creates a new instance of OrderedMap

func (*OrderedMap) Clear

func (om *OrderedMap) Clear()

Clear removes all elements from the map

func (*OrderedMap) Copy

func (om *OrderedMap) Copy() *OrderedMap

Copy returns a new OrderedMap with the same elements

func (*OrderedMap) Delete

func (om *OrderedMap) Delete(key any)

Delete removes the element with the given key

func (*OrderedMap) Get

func (om *OrderedMap) Get(key any) (any, bool)

Get returns the value associated with the given key

func (*OrderedMap) Has

func (om *OrderedMap) Has(key any) bool

Has returns true if the key exists in the map

func (*OrderedMap) Keys

func (om *OrderedMap) Keys() []any

Keys returns all keys in order

func (*OrderedMap) Len

func (om *OrderedMap) Len() int

Len returns the number of elements in the map

func (*OrderedMap) Range

func (om *OrderedMap) Range(f func(key, value any) bool)

Range iterates over the map in order and calls the given function for each key-value pair If the function returns false, the iteration stops

func (*OrderedMap) Set

func (om *OrderedMap) Set(key, value any)

Set adds a new key-value pair or updates an existing one

func (*OrderedMap) String

func (om *OrderedMap) String() string

String returns the string representation of the map

func (*OrderedMap) Values

func (om *OrderedMap) Values() []any

Values returns all values in order

type Pair

type Pair struct {
	Key   any
	Value any
}

Pair represents a key-value pair

Jump to

Keyboard shortcuts

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