⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 citylist.java

📁 TestDataBuilder是一个采用Java编写的
💻 JAVA
字号:
package resources.datatype.address;

import java.util.ArrayList;
import java.util.List;

import com.testDataBuilder.util.RandomUtil;

public class CityList {

    private String state;

    private int length = 0;
    
    private List<String> citys = new ArrayList<String>();
    
    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public List<String> getCitys() {
        return citys;
    }

    public void setCitys(List<String> citys) {
        this.citys = citys;
    }
    
    public String randomCity(){
        if(length == 0){
            length = citys.size();
        }
        int index = RandomUtil.randomInt(0, length-1);
        return this.citys.get(index);
    }
    
    public String randomStateCity(){
        if(length == 0){
            length = citys.size();
        }
        int index = RandomUtil.randomInt(0, length-1);
        return this.getState() + "," + this.citys.get(index);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -