orderedmap

package
v0.0.0-...-fa26ab0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 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) 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) Get

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

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

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.

Jump to

Keyboard shortcuts

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