public boolean isWithinRange(final Duration duration){
  return duration.compareTo(min) >= 0 && duration.compareTo(max) <= 0;
}

public boolean isWithinRange ( final Duration duration ) { return duration . compareTo ( min ) >= 0 && duration . compareTo ( max ) <= 0 ; }
checks if the requested duration is in the defined min / max range .
