@@ -38,17 +38,31 @@ public class GeoJsonMultiPoint implements GeoJson<Iterable<Point>> {
38
38
39
39
private final List <Point > points ;
40
40
41
+ /**
42
+ * Creates a new {@link GeoJsonMultiPoint} for the given {@link Point}.
43
+ *
44
+ * @param point must not be {@literal null}.
45
+ * @since 3.2.5
46
+ */
47
+ public GeoJsonMultiPoint (Point point ) {
48
+
49
+ Assert .notNull (point , "Point must not be null!" );
50
+
51
+ this .points = new ArrayList <>();
52
+ this .points .add (point );
53
+ }
54
+
41
55
/**
42
56
* Creates a new {@link GeoJsonMultiPoint} for the given {@link Point}s.
43
57
*
44
- * @param points points must not be {@literal null} and have at least 1 entry.
58
+ * @param points points must not be {@literal null} and not empty
45
59
*/
46
60
public GeoJsonMultiPoint (List <Point > points ) {
47
61
48
- Assert .notNull (points , "Points must not be null. " );
49
- Assert .isTrue (points . size () >= 1 , "Minimum of 1 Point required. " );
62
+ Assert .notNull (points , "Points must not be null! " );
63
+ Assert .notEmpty (points , "Points must contain at least one point! " );
50
64
51
- this .points = new ArrayList <Point >(points );
65
+ this .points = new ArrayList <>(points );
52
66
}
53
67
54
68
/**
@@ -64,25 +78,12 @@ public GeoJsonMultiPoint(Point first, Point second, Point... others) {
64
78
Assert .notNull (second , "Second point must not be null!" );
65
79
Assert .notNull (others , "Additional points must not be null!" );
66
80
67
- this .points = new ArrayList <Point >();
81
+ this .points = new ArrayList <>();
68
82
this .points .add (first );
69
83
this .points .add (second );
70
84
this .points .addAll (Arrays .asList (others ));
71
85
}
72
86
73
- /**
74
- * Creates a new {@link GeoJsonMultiPoint} for the given {@link Point}.
75
- *
76
- * @param point must not be {@literal null}.
77
- */
78
- public GeoJsonMultiPoint (Point point ) {
79
-
80
- Assert .notNull (point , "First point must not be null!" );
81
-
82
- this .points = new ArrayList <Point >();
83
- this .points .add (point );
84
- }
85
-
86
87
/*
87
88
* (non-Javadoc)
88
89
* @see org.springframework.data.mongodb.core.geo.GeoJson#getType()
0 commit comments