/** * Returns a unique instance of the given range, except if the range is empty. * * <div class="note"><b>Rational:</b> * we exclude empty ranges because the {@link Range#equals(Object)} consider them as equal. * Consequently if empty ranges were included in the pool, this method would return in some * occasions an empty range with different values than the given {@code range} argument. * </div> */ static <E extends Number & Comparable<? super E>, T extends NumberRange<E>> T unique(T range) { if (!range.isEmpty()) { range = POOL.unique(range); } return range; }
/** * Returns a unique instance of the given range, except if the range is empty. * * <div class="note"><b>Rational:</b> * we exclude empty ranges because the {@link Range#equals(Object)} consider them as equal. * Consequently if empty ranges were included in the pool, this method would return in some * occasions an empty range with different values than the given {@code range} argument. * </div> * * We use this method only for caching range of wrapper of primitive types ({@link Byte}, * {@link Short}, <i>etc.</i>) because those type are known to be immutable. */ static <E extends Number & Comparable<? super E>, T extends NumberRange<E>> T unique(T range) { if (!range.isEmpty()) { range = POOL.unique(range); } return range; }
if (range != null && !range.isEmpty()) { final Number min = range.getMinValue(); final Number max = range.getMaxValue();
if (range != null && !range.isEmpty()) { final Number min = range.getMinValue(); final Number max = range.getMaxValue();