Compares this range to another object to test if they are equal. To be equal, the minimum and maximum values must be equal, which ignores any differences in the comparator. @param obj the reference object with which to compare. @return true if this object is equal.
(final Object obj)
| 308 | * @return true if this object is equal. |
| 309 | */ |
| 310 | @Override |
| 311 | public boolean equals(final Object obj) { |
| 312 | if (obj == this) { |
| 313 | return true; |
| 314 | } |
| 315 | if (obj == null || obj.getClass() != getClass()) { |
| 316 | return false; |
| 317 | } |
| 318 | @SuppressWarnings("unchecked") // OK because we checked the class above |
| 319 | final |
| 320 | Range<T> range = (Range<T>) obj; |
| 321 | return minimum.equals(range.minimum) && |
| 322 | maximum.equals(range.maximum); |
| 323 | } |
| 324 | |
| 325 | /** |
| 326 | * Fits the given element into this range by returning the given element or, if out of bounds, the range minimum if |
no test coverage detected