Skip to content

Commit

Permalink
String.join does not exist in java 7. use Joiner instead
Browse files Browse the repository at this point in the history
  • Loading branch information
omershelef committed Aug 8, 2015
1 parent b367fc5 commit dbec906
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package org.nlpcn.es4sql.spatial;
import org.elasticsearch.common.base.Joiner;

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

Expand Down Expand Up @@ -58,7 +60,7 @@ private static String multiLineStringCoordinatesFromWkt(String wkt) {
for (int i=0;i<lineStrings.length;i++){
coordinates[i] = lineStringCoordinatesFromWkt(lineStrings[i]);
}
String multiLineStringCoordinates = String.join(",", coordinates);
String multiLineStringCoordinates = Joiner.on(',').join(coordinates);
return String.format("[%s]", multiLineStringCoordinates);

}
Expand Down Expand Up @@ -86,7 +88,7 @@ private static String multiPolygonCoordinatesFromWkt(String wkt) {
for (int i=0;i<polygons.length;i++){
polygonsCoordinates[i] = polygonCoordinatesFromWkt(polygons[i]);
}
String coordinates = String.join(",", polygonsCoordinates);
String coordinates = Joiner.on(',').join(polygonsCoordinates);
return String.format("[%s]", coordinates);
}

Expand All @@ -109,7 +111,7 @@ private static String polygonCoordinatesFromWkt(String wkt) {
String polygonCoordinates = getJsonArrayFromListOfPoints(polygons[i]);
coordinatesOfPolygons[i] = polygonCoordinates;
}
coordinates = String.join(",",coordinatesOfPolygons);
coordinates = Joiner.on(',').join(coordinatesOfPolygons);
}
else {
coordinates = getJsonArrayFromListOfPoints(wkt);
Expand All @@ -123,7 +125,7 @@ private static String getJsonArrayFromListOfPoints(String pointsInWkt) {
for(String point : points){
coordinates.add(extractCoordinateFromPoint(point));
}
String joinedCoordinates = String.join(",", coordinates);
String joinedCoordinates = Joiner.on(',').join(coordinates);
return String.format("[%s]", joinedCoordinates);
}

Expand Down

0 comments on commit dbec906

Please sign in to comment.