Skip to content

Commit 9bd9b7f

Browse files
authored
[NAVAND-2844] Improve array creation while parsing (#1582)
1 parent 59cc2cf commit 9bd9b7f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

services-geojson/src/main/java/com/mapbox/geojson/BaseCoordinatesTypeAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected List<Double> readPointList(JsonReader in) throws IOException {
7171
throw new NullPointerException();
7272
}
7373

74-
List<Double> coordinates = new ArrayList<Double>();
74+
List<Double> coordinates = new ArrayList<Double>(3);
7575
in.beginArray();
7676
while (in.hasNext()) {
7777
coordinates.add(in.nextDouble());

services-geojson/src/main/java/com/mapbox/geojson/gson/BoundingBoxTypeAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void write(JsonWriter out, BoundingBox value) throws IOException {
6060
@Override
6161
public BoundingBox read(JsonReader in) throws IOException {
6262

63-
List<Double> rawCoordinates = new ArrayList<Double>();
63+
List<Double> rawCoordinates = new ArrayList<Double>(6);
6464
in.beginArray();
6565
while (in.hasNext()) {
6666
rawCoordinates.add(in.nextDouble());

0 commit comments

Comments
 (0)