import java.util.ArrayList;
import java.util.Collections;
public class Test_01 {
public static void main(String[] args) {
ArrayList<String> list =new ArrayList<>();
ArrayList<String> list2 = new ArrayList<>();
ArrayList<String> list3 = new ArrayList<>();
Collections.addAll(list,"1","2","3","4","5","6","7","8","9");
Collections.addAll(list2,"万","筒","条");
for (String s : list) {
for (String s1 : list2) {
String str = s +s1;
for (int i = 0; i < 4; i++) {
list3.add(str);
}
}
}
System.out.println("洗牌前=====================");
System.out.print("[");
for (int i = 0; i < list3.size(); i++) {
if(i != list3.size()-1){
System.out.print(list3.get(i)+",");
}else {
System.out.println(list3.get(i)+"]");
}
}
System.out.println("============================");
Collections.shuffle(list3);
System.out.print("[");
for (int i = 0; i < list3.size(); i++) {
if(i != list3.size()-1){
System.out.print(list3.get(i) + ",");
}else {
System.out.println(list3.get(i) + "]");
}
}
System.out.println("牌的张数:" + list3.size());
ArrayList<String> list4 = new ArrayList<>();
ArrayList<String> list5 = new ArrayList<>();
ArrayList<String> list6 = new ArrayList<>();
ArrayList<String> list7 = new ArrayList<>();
int q1 = 0;
for (int i = 0; i < list3.size(); i++) {
if(i %4 ==0){
list4.add(list3.get(i));
}else if (i %4 ==1){
list5.add(list3.get(i));
}else if (i % 4==2){
list6.add(list3.get(i));
}else {
list7.add(list3.get(i));
q1++;
}
if(q1 ==13){
break;
}
}
System.out.println("任正非" +list4);
System.out.println("张一鸣" +list5);
System.out.println("李书福" +list6);
System.out.println("黄冠亨" +list7);
}
}
02-06
06-13