github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/structure/maps/map.go (about)

     1  package maps
     2  
     3  import "github.com/songzhibin97/go-baseutils/structure/containers"
     4  
     5  // Map interface that all maps implement
     6  type Map[K comparable, V any] interface {
     7  	Put(key K, value V)
     8  	Get(key K) (value V, found bool)
     9  	Remove(key K)
    10  	Keys() []K
    11  
    12  	containers.Container[V]
    13  	// Empty() bool
    14  	// Size() int
    15  	// Clear()
    16  	// Values() []E
    17  	// String() string
    18  }
    19  
    20  // BidiMap interface that all bidirectional maps implement (extends the Map interface)
    21  type BidiMap[K comparable, V comparable] interface {
    22  	GetKey(value V) (key K, found bool)
    23  
    24  	Map[K, V]
    25  }