mapx

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 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 Mapx

type Mapx[Key comparable, Value any] interface {
	Get(Key) (Value, bool)     // Get value by key.
	Set(Key, Value)            // Set value to key.
	Delete(Key)                // Delete by key.
	Len() int                  // Get length.
	Range(fn func(Key, Value)) // Range.
	Keys() []Key               // Get keys.
}

Mapx generic type map which is thread safe or not

func New

func New[Key comparable, Value any](threadSafe bool) Mapx[Key, Value]

New[Key comparable, Value any](threadSafe bool) returns a new Mapx[Key, Value] based on the value of threadSafe.

threadSafe: a boolean indicating whether the mapx should be thread safe or not. Returns: an instance of Mapx[Key, Value], either a thread safe or non-thread safe depending on the value of threadSafe.

Jump to

Keyboard shortcuts

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