it.vige.cities.result.Nodes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cities-generator Show documentation
Show all versions of cities-generator Show documentation
Generate a file with the cities of your country
The newest version!
package it.vige.cities.result;
import static java.util.stream.Collectors.toList;
import java.util.ArrayList;
import java.util.List;
/**
* Nodes containing the informations of the cities from the providers
* @author lucastancapiano
*/
public class Nodes implements Cloneable {
/**
* Separator for id node
*/
public final static String ID_SEPARATOR = "-";
private List zones = new ArrayList();
/**
* default nodes
*/
public Nodes() {
}
/**
* Zones
* @return the list of nodes
*/
public List getZones() {
return zones;
}
/**
* Zones
* @param zones the list of zones
*/
public void setZones(List zones) {
this.zones = zones;
}
@Override
public Object clone() {
try {
Nodes nodes = (Nodes) super.clone();
List zones = nodes.getZones();
nodes.setZones(zones.parallelStream().map(p -> (Node) p.clone()).collect(toList()));
return nodes;
} catch (CloneNotSupportedException e) {
return null;
}
}
}