/** * Get the value for the given interval. * * @param interval interval * @return found value or the default value if not found * @throws IllegalArgumentException if the element doesn't exist */ public short getShort(Interval interval) { final int index = getIndex(interval.getLow(), interval.getHigh()); if (index >= 0) { return values[index / 2]; } throw new IllegalArgumentException("The element doesn't exist"); }
/** * Get the value for the given interval. * * @param interval interval * @return found value or the default value if not found * @throws IllegalArgumentException if the element doesn't exist */ public short getShort(Interval interval) { final int index = getIndex(interval.getLow(), interval.getHigh()); if (index >= 0) { return values[index / 2]; } throw new IllegalArgumentException("The element doesn't exist"); }
/** * Get the value for the given interval. * <p> * Return <code>defaultValue</code> if the value is not found. * * @param interval interval * @param defaultValue default value * @return found value or the default value if not found */ public short getShort(Interval interval, short defaultValue) { final int index = getIndex(interval.getLow(), interval.getHigh()); if (index >= 0) { return values[index / 2]; } return defaultValue; }
/** * Get the value for the given interval. * <p> * Return <code>defaultValue</code> if the value is not found. * * @param interval interval * @param defaultValue default value * @return found value or the default value if not found */ public short getShort(Interval interval, short defaultValue) { final int index = getIndex(interval.getLow(), interval.getHigh()); if (index >= 0) { return values[index / 2]; } return defaultValue; }