mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
21 lines
355 B
Go
21 lines
355 B
Go
package maps
|
|
|
|
import "golang.org/x/exp/constraints"
|
|
|
|
type Map[K constraints.Ordered, V any] interface {
|
|
Set(key K, value V)
|
|
Get(key K) (value V, ok bool)
|
|
Exist(key K) bool
|
|
Delete(key K)
|
|
Clone() Map[K, V]
|
|
Clear()
|
|
Count() int
|
|
Iter() <-chan *Entry[K, V]
|
|
ForEach(f func(K, V))
|
|
}
|
|
|
|
type Entry[K constraints.Ordered, V any] struct {
|
|
Key K
|
|
Value V
|
|
}
|