@Test public void testComparison() throws InterruptedException { ChangeSet oldest = new ChangeSet("test", "Michael de Jong"); Thread.sleep(100); ChangeSet newest = new ChangeSet("test", "Michael de Jong"); assertEquals(-1, oldest.compareTo(newest)); }
@Override public int compareTo(ChangeSet o) { return Comparator.comparing(ChangeSet::getCreated).compare(this, o); }
ChangeSet implements Comparable<ChangeSet> { @Override public int compareTo(ChangeSet o) { return Comparator.comparing(ChangeSet::getCreated).compare(this, o); } }
ChangeSet implements Comparable<ChangeSet> { @Override public int compareTo(ChangeSet o) { return Comparator.comparing(ChangeSet::getCreated).compare(this, o); } ChangeSet(String id, String author);  ChangeSet(String id, String author, String description);   ChangeSet(String id, String author, Date created, String description); }
ChangeSet implements Comparable<ChangeSet> { @Override public int compareTo(ChangeSet o) { return Comparator.comparing(ChangeSet::getCreated).compare(this, o); } ChangeSet(String id, String author);  ChangeSet(String id, String author, String description);   ChangeSet(String id, String author, Date created, String description); @Override int compareTo(ChangeSet o); }
ChangeSet implements Comparable<ChangeSet> { @Override public int compareTo(ChangeSet o) { return Comparator.comparing(ChangeSet::getCreated).compare(this, o); } ChangeSet(String id, String author);  ChangeSet(String id, String author, String description);   ChangeSet(String id, String author, Date created, String description); @Override int compareTo(ChangeSet o);  }