Changed the getLatestMessage to be java 7 syntax
parent
b4661d0fed
commit
37002a7f1e
|
@ -39,9 +39,12 @@ public class BulletinBoardUtils {
|
|||
* @return BulletinBoardMessage
|
||||
*/
|
||||
public static BulletinBoardMessage getLatestMessage(Collection<BulletinBoardMessage> messages){
|
||||
return Collections.max(messages, (first, second) -> {
|
||||
TimestampComparator comparator = new TimestampComparator();
|
||||
return comparator.compare(first.getMsg().getTimestamp(), second.getMsg().getTimestamp());
|
||||
return Collections.max(messages, new Comparator<BulletinBoardMessage>() {
|
||||
@Override
|
||||
public int compare(BulletinBoardMessage o1, BulletinBoardMessage o2) {
|
||||
TimestampComparator comparator = new TimestampComparator();
|
||||
return comparator.compare(o1.getMsg().getTimestamp(), o2.getMsg().getTimestamp());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Comparator;
|
|||
/**
|
||||
* Created by Arbel Deutsch Peled on 20-Feb-16.
|
||||
*/
|
||||
public class TimestampComparator implements Comparator<com.google.protobuf.Timestamp> {
|
||||
public class TimestampComparator implements Comparator<Timestamp> {
|
||||
|
||||
@Override
|
||||
public int compare(Timestamp o1, Timestamp o2) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package meerkat.registry.AsyncRegistryCallbacks;
|
||||
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage;
|
||||
import meerkat.protobuf.VoterRegistry;
|
||||
import meerkat.registry.RegistryTags;
|
||||
|
||||
|
|
Loading…
Reference in New Issue