1 package org.geojson;
2 
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.Iterator;
6 import java.util.List;
7 
8 public class FeatureCollection extends GeoJsonObject implements Iterable<Feature> {
9 
10 	private List<Feature> features = new ArrayList<Feature>();
11 
getFeatures()12 	public List<Feature> getFeatures() {
13 		return features;
14 	}
15 
setFeatures(List<Feature> features)16 	public void setFeatures(List<Feature> features) {
17 		this.features = features;
18 	}
19 
add(Feature feature)20 	public FeatureCollection add(Feature feature) {
21 		features.add(feature);
22 		return this;
23 	}
24 
addAll(Collection<Feature> features)25 	public void addAll(Collection<Feature> features) {
26 		this.features.addAll(features);
27 	}
28 
29 	@Override
iterator()30 	public Iterator<Feature> iterator() {
31 		return features.iterator();
32 	}
33 
34 	@Override
accept(GeoJsonObjectVisitor<T> geoJsonObjectVisitor)35 	public <T> T accept(GeoJsonObjectVisitor<T> geoJsonObjectVisitor) {
36 		return geoJsonObjectVisitor.visit(this);
37 	}
38 
39 	@Override
equals(Object o)40 	public boolean equals(Object o) {
41 		if (this == o)
42 			return true;
43 		if (!(o instanceof FeatureCollection))
44 			return false;
45 		FeatureCollection features1 = (FeatureCollection)o;
46 		return features.equals(features1.features);
47 	}
48 
49 	@Override
hashCode()50 	public int hashCode() {
51 		return features.hashCode();
52 	}
53 
54 	@Override
toString()55 	public String toString() {
56 		return "FeatureCollection{" + "features=" + features + '}';
57 	}
58 }
59