Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golang版本的BaseSearchEx sortMap函数没有起到排序的作用 #101

Open
youminxue opened this issue Apr 28, 2022 · 0 comments
Open
Labels

Comments

@youminxue
Copy link

func (s *BaseSearchEx) sortMap(mp map[int32]int) []int32 {
var newMp = make([]int, 0)
var newMpKey = make([]int32, 0)
for oldk, v := range mp {
newMp = append(newMp, v)
newMpKey = append(newMpKey, oldk)
}
sort.Ints(newMp) //排序

list := make([]int32, 0)
for k, _ := range newMp { //这里的k是下标是0到len(newMp)-1,也就是跟for k:=0;k<len(newMp);k++ {一样,上面排序没有用 
	list = append(list, newMpKey[k])
}
return list

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants