将集合中的顺序以乱序打乱排列
使用Collection.sort( lists, new Comparator<list>()){ // 对集合 lists 自定义排序
@override
public int compara(list a , list b ){
return Math.random()>0.5? 1:-1 ; //关键点 使得此方法随即返回 1 或 -1
}
}
将集合中的顺序以乱序打乱排列
使用Collection.sort( lists, new Comparator<list>()){ // 对集合 lists 自定义排序
@override
public int compara(list a , list b ){
return Math.random()>0.5? 1:-1 ; //关键点 使得此方法随即返回 1 或 -1
}
}