To know a key k exist in a map M1[k]v is very straightforward in Go.
if v, ok := M1[k]; ok {
// key exist
}
'v': a value of a non-pointer type.
If v is large, To just check if a particular key exists using the above method is not efficient as it will load the value v in the memory(even if I use a blank identifier _ in the place of v as per my understanding and please correct me if my understanding is wrong here).
Is there an efficient way in which we can check if a key is present in a Map(without reading/or the value is allocated in the memory)?
I am thinking to create a new map M2[k]bool to store the information and make an entry in M2 each time I insert something in M1.