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乱序输出
最新推荐文章于 2024-06-02 01:38:52 发布