@Test public void shouldCompareTwoPlusInfinitiesAsEqual() { RangeBoundary<Integer> boundaryA = new RangeBoundary<Integer>(null); RangeBoundary<Integer> boundaryB = new RangeBoundary<Integer>(null); assertThat(boundaryA.compareTo(boundaryB)).isEqualTo(0); }
@Override public int compareTo(RangeBoundary<C> other) { if (this.infinity && other.infinity) { return this.infinitySign - other.infinitySign; } if (this.infinity) { return this.isPlusInfinity() ? 1 : -1; } if (other.infinity) { return other.isPlusInfinity() ? -1 : 1; } return this.value.compareTo(other.value); }
RangeBoundary implements Comparable<RangeBoundary<C>> { @Override public int compareTo(RangeBoundary<C> other) { if (this.infinity && other.infinity) { return this.infinitySign - other.infinitySign; } if (this.infinity) { return this.isPlusInfinity() ? 1 : -1; } if (other.infinity) { return other.isPlusInfinity() ? -1 : 1; } return this.value.compareTo(other.value); } }
RangeBoundary implements Comparable<RangeBoundary<C>> { @Override public int compareTo(RangeBoundary<C> other) { if (this.infinity && other.infinity) { return this.infinitySign - other.infinitySign; } if (this.infinity) { return this.isPlusInfinity() ? 1 : -1; } if (other.infinity) { return other.isPlusInfinity() ? -1 : 1; } return this.value.compareTo(other.value); } private  RangeBoundary(C value, boolean infinity, int infinitySign);  RangeBoundary(C value); }
RangeBoundary implements Comparable<RangeBoundary<C>> { @Override public int compareTo(RangeBoundary<C> other) { if (this.infinity && other.infinity) { return this.infinitySign - other.infinitySign; } if (this.infinity) { return this.isPlusInfinity() ? 1 : -1; } if (other.infinity) { return other.isPlusInfinity() ? -1 : 1; } return this.value.compareTo(other.value); } private  RangeBoundary(C value, boolean infinity, int infinitySign);  RangeBoundary(C value); @Override int compareTo(RangeBoundary<C> other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
RangeBoundary implements Comparable<RangeBoundary<C>> { @Override public int compareTo(RangeBoundary<C> other) { if (this.infinity && other.infinity) { return this.infinitySign - other.infinitySign; } if (this.infinity) { return this.isPlusInfinity() ? 1 : -1; } if (other.infinity) { return other.isPlusInfinity() ? -1 : 1; } return this.value.compareTo(other.value); } private  RangeBoundary(C value, boolean infinity, int infinitySign);  RangeBoundary(C value); @Override int compareTo(RangeBoundary<C> other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }