Skip to content

Commit b170e9f

Browse files
committed
implement Comparable for Coursebook
1 parent a036d6c commit b170e9f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/main/kotlin/coursebook/data/Coursebook.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ class Coursebook(
1818
val semester: Semester,
1919
@Field("updated_at")
2020
var updatedAt: Instant = Instant.now(),
21-
)
21+
) : Comparable<Coursebook> {
22+
override fun compareTo(other: Coursebook): Int =
23+
compareBy<Coursebook> { it.year }
24+
.thenBy { it.semester }
25+
.compare(this, other)
26+
}

0 commit comments

Comments
 (0)