同步map只读接口

This commit is contained in:
kercylan98 2023-05-05 17:01:20 +08:00
parent 02dfd49368
commit 32f28fb457
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package synchronization
// MapReadonly 并发安全的只读字典接口
type MapReadonly[Key comparable, Value any] interface {
Get(key Key) Value
Exist(key Key) bool
GetExist(key Key) (Value, bool)
Length() int
Range(handle func(key Key, value Value))
RangeSkip(handle func(key Key, value Value) bool)
RangeBreakout(handle func(key Key, value Value) bool)
RangeFree(handle func(key Key, value Value, skip func(), breakout func()))
Keys() []Key
Slice() []Value
Map() map[Key]Value
Size() int
}