- /** Comparator for posts, sorts descending by time. */
- public static final Comparator<Post> NEWEST_FIRST = new Comparator<Post>() {
-
- @Override
- public int compare(Post leftPost, Post rightPost) {
- return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, rightPost.getTime() - leftPost.getTime()));
- }
-
- };
-
- /** Filter for posts with timestamps from the future. */
- public static final Predicate<Post> FUTURE_POSTS_FILTER = new Predicate<Post>() {
-
- @Override
- public boolean apply(Post post) {
- return (post != null) && (post.getTime() <= System.currentTimeMillis());
- }
-
- };
-