public class fenzu {
public static void main(String[] args) {
String[] teamarray ={"科特迪瓦","阿根廷","澳大利亚","塞尔维亚","荷兰","尼日利亚","日本","美国","中国","新西兰",
"巴西","比利时","韩国","喀麦隆","洪都拉斯","意大利"};
List<String> countryList = new ArrayList<String>();
Map<Integer,List<String>> teammap = new HashMap<Integer,List<String>>();
for (String string:teamarray){
countryList.add(string);
}
for (int i = 0;i < 4;i++){
List<String> list = new ArrayList<String>();
for (int j = 0;j < 4;j++){
Random random = new Random();
int num = random.nextInt(countryList.size());
String teamname = countryList.get(num);
list.add(teamname);
countryList.remove(teamname);
}
teammap.put(i+1,list);
}
for (Integer in : teammap.keySet()){
System.out.println(in+"---"+teammap.get(in));
}
}
}
分组
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 字段命名别名 关键字 as ,as之前为待命名的表或字段,之后为命名别名,其中 as 可以省略 求最大最小值 关键...
- searchHistoryArray = [searchStr componentsSeparatedByStri...