Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize capacity & add assert messages in GeoJson #4905

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public GeoJsonMultiPoint(Point first, Point second, Point... others) {
Assert.notNull(second, "Second point must not be null");
Assert.notNull(others, "Additional points must not be null");

this.points = new ArrayList<>();
this.points = new ArrayList<>(2 + others.length);
this.points.add(first);
this.points.add(second);
this.points.addAll(Arrays.asList(others));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ public List<GeoJsonLineString> getCoordinates() {

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

ArrayList<Point> result = new ArrayList<Point>(3 + others.length);
Assert.notNull(first, "First point must not be null");
Assert.notNull(second, "Second point must not be null");
Assert.notNull(third, "Third point must not be null");
Assert.notNull(fourth, "Fourth point must not be null");
Assert.notNull(others, "Additional points must not be null");

ArrayList<Point> result = new ArrayList<Point>(4 + others.length);

result.add(first);
result.add(second);
Expand Down