File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/main/java/org/scijava/util Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -184,18 +184,19 @@ public String getCIManagementURL() {
184
184
185
185
// -- Comparable methods --
186
186
187
- @ Override
188
- public int compareTo (final POM pom ) {
187
+ private static final Comparator <String > STRING_COMPARATOR = //
188
+ Comparator .nullsFirst (String ::compareTo );
189
+ private static final Comparator <POM > POM_COMPARATOR = Comparator //
189
190
// sort by groupId first
190
- final int gid = getGroupId ().compareTo (pom .getGroupId ());
191
- if (gid != 0 ) return gid ;
192
-
191
+ .comparing (POM ::getGroupId , STRING_COMPARATOR )
193
192
// sort by artifactId second
194
- final int aid = getArtifactId ().compareTo (pom .getArtifactId ());
195
- if (aid != 0 ) return aid ;
196
-
193
+ .thenComparing (POM ::getArtifactId , STRING_COMPARATOR )//
197
194
// finally, sort by version
198
- return compareVersions (getVersion (), pom .getVersion ());
195
+ .thenComparing (POM ::getVersion , POM ::compareVersions );
196
+
197
+ @ Override
198
+ public int compareTo (final POM pom ) {
199
+ return POM_COMPARATOR .compare (this , pom );
199
200
}
200
201
201
202
// -- Versioned methods --
You can’t perform that action at this time.
0 commit comments