go snippets
golang检查map是否为空 1 2 3 if len(map) == 0 { .... } 时间复杂度: O(1) 参考: How to check if a map is empty in Golang? Preappend slice 1 2 3 4 5 6 x = append([]int{1}, x...) // 或 x = append(x, 0) copy(x[1:], x) x[0] = 1 参考:How to prepend
Read more...