+ /** Comparator that sorts replies ascending by time. */
+ public static final Comparator<Reply> TIME_COMPARATOR = new Comparator<Reply>() {
+
+ @Override
+ public int compare(Reply leftReply, Reply rightReply) {
+ return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, leftReply.getTime() - rightReply.getTime()));
+ }
+
+ };
+
+ /** Filter for replies with timestamps from the future. */
+ public static final Filter<Reply> FUTURE_REPLIES_FILTER = new Filter<Reply>() {
+
+ @Override
+ public boolean filterObject(Reply reply) {
+ return reply.getTime() <= System.currentTimeMillis();
+ }
+
+ };
+