实现代码如下:
List<VCard> vcards = new ArrayList<>();
// add some elements to vcards
...
// 随机 100
Random r = new Random();
List<VCard> randomList = new ArrayList<>();
while (randomList.size() < 100){
randomList.add(vcards.get(r.nextInt(vcards.size())));
}
References