File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/java/io/codebottle/api/model Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 44import java .util .ArrayList ;
55import java .util .Collection ;
66import java .util .Collections ;
7+ import java .util .Comparator ;
78import java .util .List ;
89import java .util .Optional ;
910import java .util .concurrent .CompletableFuture ;
1314import io .codebottle .api .CodeBottle ;
1415import io .codebottle .api .rest .CodeBottleRequest ;
1516import io .codebottle .api .rest .Endpoint ;
17+ import org .jetbrains .annotations .Contract ;
18+ import org .jetbrains .annotations .NotNull ;
1619import org .jetbrains .annotations .Nullable ;
1720
1821public class Snippet extends AbstractEntity {
@@ -168,7 +171,9 @@ public CompletableFuture<List<Revision>> requestRevisions() {
168171 });
169172 }
170173
171- public static class Revision extends AbstractEntity {
174+ public static class Revision extends AbstractEntity implements Comparable <Revision > {
175+ public static final Comparator <Revision > REVISION_COMPARATOR = Comparator .comparingInt (entity -> Integer .parseInt (entity .getID ()));
176+
172177 private @ JsonProperty (required = true ) String title ;
173178 private @ JsonProperty @ Nullable String description ;
174179 private @ JsonProperty (required = true ) String code ;
@@ -233,5 +238,11 @@ public Revision update(JsonNode data) {
233238
234239 return this ;
235240 }
241+
242+ @ Override
243+ @ Contract (pure = true )
244+ public int compareTo (@ NotNull Snippet .Revision other ) {
245+ return 0 ;
246+ }
236247 }
237248}
You can’t perform that action at this time.
0 commit comments