@Test public void testEquals() { Range<Integer> r = Range.create(-10, true, 10, false); Range<Integer> same = Range.create(-10, true, 10, false); Range<Integer> different = Range.create(-10, false, 10, true); assertTrue(r.equals(same)); assertFalse(r.equals(different)); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range<T> other = (Range<T>) obj; if (this.isPoint != other.isPoint) { return false; } if (this.minValue != other.minValue && (this.minValue == null || !this.minValue.equals(other.minValue))) { return false; } if (this.minIncluded != other.minIncluded) { return false; } if (this.maxValue != other.maxValue && (this.maxValue == null || !this.maxValue.equals(other.maxValue))) { return false; } if (this.maxIncluded != other.maxIncluded) { return false; } return true; }
Range { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range<T> other = (Range<T>) obj; if (this.isPoint != other.isPoint) { return false; } if (this.minValue != other.minValue && (this.minValue == null || !this.minValue.equals(other.minValue))) { return false; } if (this.minIncluded != other.minIncluded) { return false; } if (this.maxValue != other.maxValue && (this.maxValue == null || !this.maxValue.equals(other.maxValue))) { return false; } if (this.maxIncluded != other.maxIncluded) { return false; } return true; } }
Range { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range<T> other = (Range<T>) obj; if (this.isPoint != other.isPoint) { return false; } if (this.minValue != other.minValue && (this.minValue == null || !this.minValue.equals(other.minValue))) { return false; } if (this.minIncluded != other.minIncluded) { return false; } if (this.maxValue != other.maxValue && (this.maxValue == null || !this.maxValue.equals(other.maxValue))) { return false; } if (this.maxIncluded != other.maxIncluded) { return false; } return true; } Range(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded);  Range(T value, int... inf);  Range(Range<T> other); }
Range { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range<T> other = (Range<T>) obj; if (this.isPoint != other.isPoint) { return false; } if (this.minValue != other.minValue && (this.minValue == null || !this.minValue.equals(other.minValue))) { return false; } if (this.minIncluded != other.minIncluded) { return false; } if (this.maxValue != other.maxValue && (this.maxValue == null || !this.maxValue.equals(other.maxValue))) { return false; } if (this.maxIncluded != other.maxIncluded) { return false; } return true; } Range(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded);  Range(T value, int... inf);  Range(Range<T> other); static Range<T> create(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded); static Range<T> create(T value, int... inf); boolean isPoint(); T getMin(); boolean isMinInf(); boolean isMinNegInf(); T getMax(); boolean isMaxInf(); boolean isMaxNegInf(); boolean isMinIncluded(); boolean isMaxIncluded(); boolean isMinOpen(); boolean isMinClosed(); boolean isMaxOpen(); boolean isMaxClosed(); boolean contains(T value); boolean intersects(Range<T> other); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
Range { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range<T> other = (Range<T>) obj; if (this.isPoint != other.isPoint) { return false; } if (this.minValue != other.minValue && (this.minValue == null || !this.minValue.equals(other.minValue))) { return false; } if (this.minIncluded != other.minIncluded) { return false; } if (this.maxValue != other.maxValue && (this.maxValue == null || !this.maxValue.equals(other.maxValue))) { return false; } if (this.maxIncluded != other.maxIncluded) { return false; } return true; } Range(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded);  Range(T value, int... inf);  Range(Range<T> other); static Range<T> create(T minValue, boolean minIncluded, T maxValue, boolean maxIncluded); static Range<T> create(T value, int... inf); boolean isPoint(); T getMin(); boolean isMinInf(); boolean isMinNegInf(); T getMax(); boolean isMaxInf(); boolean isMaxNegInf(); boolean isMinIncluded(); boolean isMaxIncluded(); boolean isMinOpen(); boolean isMinClosed(); boolean isMaxOpen(); boolean isMaxClosed(); boolean contains(T value); boolean intersects(Range<T> other); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static final int NEG_INF; static final int INF; }