View Javadoc
1   package au.gov.amsa.navigation;
2   
3   import java.util.Comparator;
4   
5   class Comparators {
6   
7       static final Comparator<VesselPosition> timeIdMessageIdComparator = (p1, p2) -> {
8           int value = ((Long) p1.time()).compareTo(p2.time());
9           if (value == 0) {
10              value = ((Long) p1.id().uniqueId()).compareTo(p2.id().uniqueId());
11              if (value == 0)
12                  return ((Long) p1.messageId()).compareTo(p2.messageId());
13              else
14                  return value;
15          } else
16              return value;
17      };
18  
19  }