class DenseLocalDateDoubleTimeSeries implements ImmutableBean, LocalDateDoubleTimeSeries, Serializable {

  @Override
  public OptionalDouble get(LocalDate date) {
    if (!isEmpty() && !date.isBefore(startDate) && dateCalculation.allowsDate(date)) {
      int position = dateCalculation.calculatePosition(startDate, date);
      if (position < points.length) {
        double value = points[position];
        if (isValidPoint(value)) {
          return OptionalDouble.of(value);
        }
      }
    }
    return OptionalDouble.empty();
  }

  private  DenseLocalDateDoubleTimeSeries(
      LocalDate startDate,
      double[] points,
      DenseTimeSeriesCalculation dateCalculation,
      boolean trusted,
      int size);
  @ImmutableConstructor private  DenseLocalDateDoubleTimeSeries(
      LocalDate startDate,
      double[] points,
      DenseTimeSeriesCalculation dateCalculation);

}