From 61699455e5c2c0c00e44f4c3868b304aa415e4aa Mon Sep 17 00:00:00 2001 From: "Nelson A. de Oliveira" Date: Wed, 31 Jul 2013 15:09:37 -0300 Subject: [PATCH] Replace StringBuffer with String These may be replaced with java.lang.String expressions which results in simpler and possibly more efficient code --- .../src/net/osmand/router/RouteResultPreparation.java | 10 ++-------- OsmAnd-java/src/net/osmand/util/MapUtils.java | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index 6a6dc90b95..04c2f74533 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -213,15 +213,9 @@ public class RouteResultPreparation { double startLon = start.getLongitude(); double endLat = end.getLatitude(); double endLon = end.getLongitude(); - StringBuilder add = new StringBuilder(); - add.append("loadedTiles = \"").append(ctx.loadedTiles).append("\" "); - add.append("visitedSegments = \"").append(ctx.visitedSegments).append("\" "); - add.append("complete_distance = \"").append(completeDistance).append("\" "); - add.append("complete_time = \"").append(completeTime).append("\" "); - add.append("routing_time = \"").append(ctx.routingTime).append("\" "); - println(MessageFormat.format("", startLat - + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, add.toString())); + + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + "complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + "routing_time = \"" + ctx.routingTime + "\" ")); if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) { for (RouteSegmentResult res : result) { String name = res.getObject().getName(); diff --git a/OsmAnd-java/src/net/osmand/util/MapUtils.java b/OsmAnd-java/src/net/osmand/util/MapUtils.java index 0651d4393c..5a071d1817 100644 --- a/OsmAnd-java/src/net/osmand/util/MapUtils.java +++ b/OsmAnd-java/src/net/osmand/util/MapUtils.java @@ -270,11 +270,7 @@ public class MapUtils { // System.out.println(buildShortOsmUrl(52.30103d, 4.862927d, 18)); // http://osm.org/go/0E4_JiVhs // System.out.println(buildShortOsmUrl(40.59d, -115.213d, 9)); // http://osm.org/go/TelHTB-- public static String buildShortOsmUrl(double latitude, double longitude, int zoom){ - StringBuilder str = new StringBuilder(10); - str.append(BASE_SHORT_OSM_URL); - str.append(createShortLocString(latitude, longitude, zoom)); - str.append("?m"); - return str.toString(); + return BASE_SHORT_OSM_URL + createShortLocString(latitude, longitude, zoom) + "?m"; } public static String createShortLocString(double latitude, double longitude, int zoom) {