@Test public void compareTo() { TtlBucket firstBucket = new TtlBucket(0); TtlBucket secondBucket = new TtlBucket(0); TtlBucket thirdBucket = new TtlBucket(1); TtlBucket fourthBucket = new TtlBucket(2); Assert.assertEquals(0, firstBucket.compareTo(firstBucket)); Assert.assertEquals(0, firstBucket.compareTo(secondBucket)); Assert.assertEquals(0, secondBucket.compareTo(firstBucket)); Assert.assertEquals(-1, firstBucket.compareTo(thirdBucket)); Assert.assertEquals(1, fourthBucket.compareTo(firstBucket)); }
@Override public int compareTo(TtlBucket ttlBucket) { long startTime1 = getTtlIntervalStartTimeMs(); long startTime2 = ttlBucket.getTtlIntervalStartTimeMs(); return Long.compare(startTime1, startTime2); }
TtlBucket implements Comparable<TtlBucket> { @Override public int compareTo(TtlBucket ttlBucket) { long startTime1 = getTtlIntervalStartTimeMs(); long startTime2 = ttlBucket.getTtlIntervalStartTimeMs(); return Long.compare(startTime1, startTime2); } }
TtlBucket implements Comparable<TtlBucket> { @Override public int compareTo(TtlBucket ttlBucket) { long startTime1 = getTtlIntervalStartTimeMs(); long startTime2 = ttlBucket.getTtlIntervalStartTimeMs(); return Long.compare(startTime1, startTime2); } TtlBucket(long startTimeMs); }
TtlBucket implements Comparable<TtlBucket> { @Override public int compareTo(TtlBucket ttlBucket) { long startTime1 = getTtlIntervalStartTimeMs(); long startTime2 = ttlBucket.getTtlIntervalStartTimeMs(); return Long.compare(startTime1, startTime2); } TtlBucket(long startTimeMs); long getTtlIntervalStartTimeMs(); long getTtlIntervalEndTimeMs(); static long getTtlIntervalMs(); Collection<Inode> getInodes(); void addInode(Inode inode); void removeInode(InodeView inode); @Override int compareTo(TtlBucket ttlBucket); @Override boolean equals(Object o); @Override int hashCode(); }
TtlBucket implements Comparable<TtlBucket> { @Override public int compareTo(TtlBucket ttlBucket) { long startTime1 = getTtlIntervalStartTimeMs(); long startTime2 = ttlBucket.getTtlIntervalStartTimeMs(); return Long.compare(startTime1, startTime2); } TtlBucket(long startTimeMs); long getTtlIntervalStartTimeMs(); long getTtlIntervalEndTimeMs(); static long getTtlIntervalMs(); Collection<Inode> getInodes(); void addInode(Inode inode); void removeInode(InodeView inode); @Override int compareTo(TtlBucket ttlBucket); @Override boolean equals(Object o); @Override int hashCode();  }