orderedmap

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0, BSD-2-Clause Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

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

Element defines the model of each element of the orderedMap.

type OrderedMap

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

OrderedMap provides a concurrent-safe ordered map.

func New

func New() *OrderedMap

New returns a new *OrderedMap.

func (*OrderedMap) Clear

func (orderedMap *OrderedMap) Clear()

Clear removes all elements from the OrderedMap.

func (*OrderedMap) Delete

func (orderedMap *OrderedMap) Delete(key interface{}) bool

Delete deletes the given key (and related value) from the orderedMap. It returns false if the key is not found.

func (*OrderedMap) ForEach

func (orderedMap *OrderedMap) ForEach(consumer func(key, value interface{}) bool) bool

ForEach iterates through the orderedMap and calls the consumer function for every element. The iteration can be aborted by returning false in the consumer.

func (*OrderedMap) ForEachReverse

func (orderedMap *OrderedMap) ForEachReverse(consumer func(key, value interface{}) bool) bool

ForEachReverse iterates through the orderedMap in reverse order and calls the consumer function for every element. The iteration can be aborted by returning false in the consumer.

func (*OrderedMap) Get

func (orderedMap *OrderedMap) Get(key interface{}) (interface{}, bool)

Get returns the value mapped to the given key if exists.

func (*OrderedMap) Has

func (orderedMap *OrderedMap) Has(key interface{}) (has bool)

Has returns if an entry with the given key exists.

func (*OrderedMap) Head

func (orderedMap *OrderedMap) Head() (key, value interface{}, exists bool)

Head returns the first map entry.

func (*OrderedMap) Initialize

func (orderedMap *OrderedMap) Initialize()

Initialize returns the first map entry.

func (*OrderedMap) Set

func (orderedMap *OrderedMap) Set(key interface{}, newValue interface{}) bool

Set adds a key-value pair to the orderedMap. It returns false if the same pair already exists.

func (*OrderedMap) Size

func (orderedMap *OrderedMap) Size() int

Size returns the size of the orderedMap.

func (*OrderedMap) Tail

func (orderedMap *OrderedMap) Tail() (key, value interface{}, exists bool)

Tail returns the last map entry.

Jump to

Keyboard shortcuts

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