GCGeneration { public int compareWith(@NotNull GCGeneration gcGeneration) { return generation - checkNotNull(gcGeneration).generation; } private  GCGeneration(int generation, int fullGeneration, boolean isCompacted); static GCGeneration newGCGeneration(int generation, int fullGeneration, boolean isCompacted); static GCGeneration newGCGeneration(SegmentArchiveEntry indexEntry); int getGeneration(); int getFullGeneration(); boolean isCompacted(); @NotNull GCGeneration nextFull(); @NotNull GCGeneration nextTail(); @NotNull GCGeneration nonGC(); int compareWith(@NotNull GCGeneration gcGeneration); int compareFullGenerationWith(@NotNull GCGeneration gcGeneration); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); static final GCGeneration NULL; }
@Test public void testCompareWith() { GCGeneration m = newGCGeneration(0, 0, false); GCGeneration n = newGCGeneration(2, 3, false); assertEquals(2, n.compareWith(m)); }