Skip to content

Commit 02c5135

Browse files
dimitarsazdovskipivovarit
authored andcommitted
Changes according to remarks (eugenp#2624)
1 parent 231500b commit 02c5135

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

geotools/src/main/java/com/baeldung/geotools/ShapeFile.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ public static void main(String[] args) throws Exception {
4141

4242
SimpleFeatureType CITY = createFeatureType();
4343

44-
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
45-
46-
addLocations(featureBuilder, collection);
44+
addLocations(CITY, collection);
4745

4846
File shapeFile = getNewShapeFile();
4947

@@ -72,7 +70,7 @@ public static SimpleFeatureType createFeatureType() {
7270
return CITY;
7371
}
7472

75-
public static void addLocations(SimpleFeatureBuilder featureBuilder, DefaultFeatureCollection collection) {
73+
public static void addLocations(SimpleFeatureType CITY, DefaultFeatureCollection collection) {
7674

7775
Map<String, List<Double>> locations = new HashMap<>();
7876

@@ -113,8 +111,10 @@ public static void addLocations(SimpleFeatureBuilder featureBuilder, DefaultFeat
113111
.get(0),
114112
location.getValue()
115113
.get(1)));
114+
115+
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
116116
featureBuilder.add(point);
117-
featureBuilder.add(name);
117+
featureBuilder.add(location.getKey());
118118
SimpleFeature feature = featureBuilder.buildFeature(null);
119119
collection.add(feature);
120120
}

geotools/src/test/java/com/baeldung/geotools/GeoToolsUnitTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ public void givenFeatureType_whenAddLocations_returnFeatureCollection() {
1616

1717
SimpleFeatureType CITY = ShapeFile.createFeatureType();
1818

19-
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
20-
21-
ShapeFile.addLocations(featureBuilder, collection);
19+
ShapeFile.addLocations(CITY, collection);
2220

2321
assertNotNull(collection);
2422

0 commit comments

Comments
 (0)