code: public Availability getEntryByDate(Date date)
     {
        Availability result = null;
  
        for (Availability entry : this)
        {
           DateRange range = entry.getRange();
           int comparisonResult = range.compareTo(date);
           if (comparisonResult >= 0)
           {
              if (comparisonResult == 0)
              {
                 result = entry;
                 break;
              }
           }
           else
           {
              break;
           }
        }
  
        return result;
     }
docs: Retrieve the table entry valid for the supplied date.
  
  @param date required date
  @return cost rate table entry