public class countryGroup {
public static void main(String[] args) {
Map<Integer,List<String>> Integer2Countrys = new HashMap<Integer,List<String>>();
List<String> ListCountry = new ArrayList<String>();
String country = "科特迪瓦,阿根廷,澳大利亚,塞尔维亚,荷兰,尼日利亚,日本,美国,中国," +
"新西兰,巴西,比利时,韩国,喀麦隆,洪都拉斯,意大利";
String[] countrys = country.split(",");
for (String string:countrys){
ListCountry.add(string);
}
for (int j = 0;j < 4;j++){
List<String> listcountrygroup = new ArrayList<String>();
for (int i = 0;i < 4;i++){
Random random = new Random();
int index = random.nextInt(ListCountry.size());
listcountrygroup.add(ListCountry.get(index));
ListCountry.remove(index);
}
Integer2Countrys.put(j+1,listcountrygroup);
}
for (Integer in : Integer2Countrys.keySet()){
System.out.println("第"+in+"组");
for (String str :Integer2Countrys.get(in)){
System.out.print(str+" ");
}
System.out.println();
}
}
}
球队分组
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
