public static <V> List<V> randomList(List<V> sourceList) {
if (sourceList == null || sourceList.size() == 0) {
return sourceList;
}
List<V> random = new ArrayList<V>(sourceList.size());
do {
int index = Math.abs(new Random().nextInt(sourceList.size()));
random.add(sourceList.remove(index));
} while (sourceList.size() > 0);
return random;
}
list乱序输出
猜你喜欢
转载自blog.csdn.net/weixin_42140580/article/details/84997602
今日推荐
周排行