首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > 高性能WEB开发 >

ConcurrentSkipListSet在指定比较器后并发add,结果顺序异常

2012-12-14 
ConcurrentSkipListSet在指定比较器后并发add,结果顺序错误?private ConcurrentSkipListSetCOoncoonnew

ConcurrentSkipListSet在指定比较器后并发add,结果顺序错误?
private ConcurrentSkipListSet<COon>coon
=new ConcurrentSkipListSet<COon>(new Comparator<COon>() {
public int compare(COon arg0, COon arg1) {
return arg0.getKey()-arg1.getKey();
}
});
/**此部分并发调用columnOption的add方法,代码略**/
for(COon coon:this.coon){
System.out.println(coon.getKey());
}
/*结果是随机顺序,为啥呢?*/

/*测试非并发调用add,则结果是升序排列*/
[解决办法]
自己顶一下,其实以前见过有人在博客里解释这个问题,但太久之前看的,具体内容忘掉了...
[解决办法]
继续顶....
[解决办法]
该回复于2012-08-10 09:50:29被版主删除

热点排行