/** * Is this years instance greater than the specified number of years. * * @param other the other period, null means zero * @return true if this years instance is greater than the specified one */ public boolean isGreaterThan(Years other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); }
/** * Is this years instance less than the specified number of years. * * @param other the other period, null means zero * @return true if this years instance is less than the specified one */ public boolean isLessThan(Years other) { if (other == null) { return getValue() < 0; } return getValue() < other.getValue(); }
/** * Returns a new instance with the specified number of years taken away. * * <p>This instance is immutable and unaffected by this method call. * * @param years the amount of years to take away, may be negative, null means zero * @return the new period minus the specified number of years * @throws ArithmeticException if the result overflows an int */ public Years minus(Years years) { if (years == null) { return this; } return minus(years.getValue()); }