🎨 Replace reply comparator with Kotlin version
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / data / Sone.kt
index c44d6e8..34403a1 100644 (file)
@@ -48,3 +48,14 @@ val postCountComparator: Comparator<Sone> =
                comparing<Sone, Int> { it.posts.size }
                                .thenComparing<Int> { it.replies.size }
                                .reversed()
+
+val imageCountComparator: Comparator<Sone> =
+               comparing<Sone, Int> { it.rootAlbum.allImages.size }.reversed()
+
+val Sone.allAlbums: List<Album>
+       get() =
+               rootAlbum.albums.flatMap(Album::allAlbums)
+
+val Sone.allImages: Collection<Image>
+       get() =
+               rootAlbum.allImages