/** * Returns {@code true} if this range contains fully the given range. * * @param range The range to check for inclusion in this range. * @return {@code true} if the given range is included in this range. * @throws IllegalArgumentException is the given range can not be converted to a valid type * through widening conversion. */ public boolean contains(final Range<?> range) throws IllegalArgumentException { return containsNC(ensureCompatible(range)); }
/** * Returns {@code true} if this range contains the given value. A range never contains the * {@code null} value. This is consistent with the {@linkplain Range class javadoc} stating that * null {@linkplain #getMinValue minimum} or {@linkplain #getMaxValue maximum} values are * exclusive. * * @param value The value to check for inclusion in this range. * @return {@code true} if the given value is included in this range. * @throws IllegalArgumentException is the given value can not be converted to a valid type * through widening conversion. */ @SuppressWarnings("unchecked") public boolean contains(final Comparable<?> value) throws IllegalArgumentException { if (value == null) { return false; } ensureCompatible(value.getClass()); return containsNC((Comparable<T>) value); }
/** * Returns {@code true} if this range contains fully the given range. * * @param range The range to check for inclusion in this range. * @return {@code true} if the given range is included in this range. * @throws IllegalArgumentException is the given range can not be converted to a valid type * through widening conversion. */ public boolean contains(final Range<?> range) throws IllegalArgumentException { return containsNC(ensureCompatible(range)); }
/** * Returns {@code true} if this range contains the given value. A range never contains the * {@code null} value. This is consistent with the {@linkplain Range class javadoc} stating * that null {@linkplain #getMinValue minimum} or {@linkplain #getMaxValue maximum} values * are exclusive. * * @param value The value to check for inclusion in this range. * @return {@code true} if the given value is included in this range. * @throws IllegalArgumentException is the given value can not be converted to a valid type * through widening conversion. */ public boolean contains(final Comparable<?> value) throws IllegalArgumentException { if (value == null) { return false; } ensureCompatible(value.getClass()); @SuppressWarnings("unchecked") final T c = (T) value; return containsNC(c); }