public int periodOfDate(Date d) { int result = adjustedDates_.BinarySearch(d); if (result < 0) // not found directly result = ~result; // the next element larger than the search value return result; }