All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.gaia.County Maven / Gradle / Ivy

package com.sksamuel.gaia;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.commons.io.IOUtils;

public class County {

	private static List	UK_COUNTIES;

	public static List getUkCities() {
		if (UK_COUNTIES == null)
			UK_COUNTIES = parse("/com/sksamuel/gaia/ukcounties.txt");
		return UK_COUNTIES;
	}

	static List parse(String file) {
		InputStream is = City.class.getResourceAsStream(file);
		try {
			List list = new ArrayList();
			List lines = IOUtils.readLines(is);
			for (String line : lines) {
				County c = new County();
				c.setName(line);
				list.add(c);
			}
			list = Collections.unmodifiableList(list);
			return list;
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	private String	name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy