Skip to content

Commit 6a0f7b8

Browse files
bactgoneall
authored andcommitted
Sort TOC
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
1 parent 03655f6 commit 6a0f7b8

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/org/spdx/storage/listedlicense/ExceptionJsonTOC.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,11 @@ public void setReleaseDate(String releaseDate) {
283283
this.releaseDate = releaseDate;
284284
}
285285

286+
/**
287+
* Sort the exceptions list by licenseExceptionId.
288+
*/
289+
public void sort() {
290+
exceptions.sort((e1, e2) -> e1.getLicenseExceptionId().compareToIgnoreCase(e2.getLicenseExceptionId()));
291+
}
292+
286293
}

src/main/java/org/spdx/storage/listedlicense/LicenseJsonTOC.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ public void setReleaseDate(String releaseDate) {
251251
this.releaseDate = releaseDate;
252252
}
253253

254+
/**
255+
* Sort the licenses list by licenseId.
256+
*/
257+
public void sort() {
258+
licenses.sort((l1, l2) -> l1.getLicenseId().compareToIgnoreCase(l2.getLicenseId()));
259+
}
260+
254261
protected static String toAbsoluteURL(String relURL) {
255262
String retval = relURL.startsWith("./") ? relURL.substring(2) : relURL;
256263
return SpdxConstantsCompatV2.LISTED_LICENSE_URL + retval;

0 commit comments

Comments
 (0)