如果想用多线程实现诸如此类的,齐,楚,燕,韩,赵,魏相继被灭,然后秦国一统天下的效果

枚举怎么写

public enum  CountryEnum {
    ONE(1,"齐"),TWO(2,"楚"),THREE(3,"燕"),FOUR(4,"韩"),FIVE(5,"赵"),SIX(6,"魏");
    private Integer retCode;//1,2,3这些数字 相当于Key
    private String  retName;//齐楚..相当于VALUE

    public Integer getRetCode() {
        return retCode;
    }

    public void setRetCode(Integer retCode) {
        this.retCode = retCode;
    }

    public String getRetName() {
        return retName;
    }

    public void setRetName(String retName) {
        this.retName = retName;
    }

    CountryEnum(Integer retCode, String retName) {
        this.retCode = retCode;
        this.retName = retName;
    }
    public static CountryEnum forEach(int index){//index对应于RetCode
        CountryEnum[] values = CountryEnum.values();
        for (CountryEnum element : values) {
            if(element.getRetCode()==index){
                return element;
            }
        }
        return null;
    }
}

CountDownLatch 的countDown()和await()方法

public class CountDownLatchDemo3 {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch latch = new CountDownLatch(6);
        for (int i = 1; i <=6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"被灭");
                latch.countDown();
            },CountryEnum.forEach(i).getRetName()).start();
        }
        latch.await();
        System.out.println("大秦帝国一统天下");
    }
}