linkedhashmap

package
v1.10.13 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hashmap

type Hashmap[K, V any] interface {
	Put(key K, val V)
	Get(key K) (val V, exists bool)
	Delete(key K)
	Len() int
}

Hashmap provides an O(1) mapping from a comparable key to any value. Comparable is defined by https://golang.org/ref/spec#Comparison_operators.

type Iter

type Iter[K, V any] interface {
	Next() bool
	Key() K
	Value() V
}

Iterates over the keys and values in a LinkedHashmap from oldest to newest elements. Assumes the underlying LinkedHashmap is not modified while the iterator is in use, except to delete elements that have already been iterated over.

type LinkedHashmap

type LinkedHashmap[K, V any] interface {
	Hashmap[K, V]

	Oldest() (key K, val V, exists bool)
	Newest() (key K, val V, exists bool)
	NewIterator() Iter[K, V]
}

LinkedHashmap is a hashmap that keeps track of the oldest pairing an the newest pairing.

func New

func New[K comparable, V any]() LinkedHashmap[K, V]

Jump to

Keyboard shortcuts

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