orderedmap

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0, BSD-2-Clause Imports: 1 Imported by: 0

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) 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