Skip to content

Commit f8d2ae8

Browse files
committed
fix: improve ArrayList capacity allocation in GeoJson
Signed-off-by: 정보교 (Bogus Jung) <[email protected]>
1 parent ceac2b8 commit f8d2ae8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonMultiPoint.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public GeoJsonMultiPoint(Point first, Point second, Point... others) {
7979
Assert.notNull(second, "Second point must not be null");
8080
Assert.notNull(others, "Additional points must not be null");
8181

82-
this.points = new ArrayList<>();
82+
this.points = new ArrayList<>(2 + others.length);
8383
this.points.add(first);
8484
this.points.add(second);
8585
this.points.addAll(Arrays.asList(others));

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonPolygon.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public List<GeoJsonLineString> getCoordinates() {
126126

127127
private static List<Point> asList(Point first, Point second, Point third, Point fourth, Point... others) {
128128

129-
ArrayList<Point> result = new ArrayList<Point>(3 + others.length);
129+
ArrayList<Point> result = new ArrayList<Point>(4 + others.length);
130130

131131
result.add(first);
132132
result.add(second);

0 commit comments

Comments
 (0)