dictionary

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dictionary

type Dictionary[K any, V any] interface {
	// Get returns the value associated with the given key.
	Get(key K) (V, bool)
	// Set sets the value associated with the given key.
	Set(key K, value V)
	// Remove removes the value associated with the given key.
	Remove(key K)
	// Keys returns the keys of the map.
	Keys() []K
	// Values returns the values of the map.
	Values() []V
	// Size returns the number of elements in the map.
	Size() int
	// IsEmpty returns true if the map is empty.
	IsEmpty() bool
	// Clear removes all elements from the map.
	Clear()

	Iterator() iterable.Iterator[pair[K, V]]
}

Dictionary is a map for use when you don't have a natively hashable type

func NewConcurrentUnordered added in v0.3.0

func NewConcurrentUnordered[K Hashable, V any]() Dictionary[K, V]

func NewConcurrentUnorderedSize added in v0.3.0

func NewConcurrentUnorderedSize[K Hashable, V any](size int) Dictionary[K, V]

func NewUnordered

func NewUnordered[K Hashable, V any]() Dictionary[K, V]

func NewUnorderedSize

func NewUnorderedSize[K Hashable, V any](size int) Dictionary[K, V]

type Hashable

type Hashable interface {
	Hash() int
}

Jump to

Keyboard shortcuts

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