We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
set := treeset.NewWithIntComparator() // empty (keys are of type int) set.Add(1) // 1 set.Add(2, 2, 3, 4, 5) // 1, 2, 3, 4, 5 (in order, duplicates ignored) //转Json字符串 marshal, _ := json.Marshal(set) fmt.Println("json编码", tool.Bytes2String(marshal)) { //此处有bug panic: interface conversion: interface {} is float64, not int set2 := treeset.NewWithIntComparator() err := json.Unmarshal(marshal, set2) fmt.Printf("json解码:%v err=%v\n", set2.Values(), err) }
The text was updated successfully, but these errors were encountered:
用最新的2.0版本带有泛型的就没问题,旧版本这个反序列话的时候,因为是使用interface来接收数据,数字类型默认解析为float64, 加到集合里面的时候会进行排序比较,比较的时候断言为int的话就会报错
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: