gitlab.com/evatix-go/core@v1.3.55/coreunique/intunique/GetMap.go (about)

     1  package intunique
     2  
     3  func GetMap(intSlice *[]int) *map[int]bool {
     4  	if intSlice == nil {
     5  		return nil
     6  	}
     7  
     8  	length := len(*intSlice)
     9  	dict := make(map[int]bool, length)
    10  
    11  	if length == 0 {
    12  		return &dict
    13  	}
    14  
    15  	for _, v := range *intSlice {
    16  		dict[v] = true
    17  	}
    18  
    19  	return &dict
    20  }