🔀 Merge branch 'release/v82'
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / data / Post.kt
1 package net.pterodactylus.sone.data
2
3 import java.util.Comparator.comparing
4
5 /**
6  * Predicate that returns whether a post is _not_ from the future,
7  * i.e. whether it should be visible now.
8  */
9 @get:JvmName("noFuturePost")
10 val noFuturePost: (Post) -> Boolean = { it.time <= System.currentTimeMillis() }
11
12 /**
13  * Comparator that orders posts by their time, newest posts first.
14  */
15 @get:JvmName("newestPostFirst")
16 val newestPostFirst: Comparator<Post> = comparing(Post::getTime).reversed()