class NoPaddingTimeSeriesSamplingFunction implements TimeSeriesSamplingFunction {

  @Override
  public LocalDateDoubleTimeSeries getSampledTimeSeries(DateDoubleTimeSeries<?> ts, LocalDate[] schedule) {
    ArgumentChecker.notNull(ts, "time series");
    ArgumentChecker.notNull(schedule, "schedule");
    LocalDateDoubleTimeSeries localDateTS = ImmutableLocalDateDoubleTimeSeries.of(ts);
    Set<LocalDate> timeSeriesSet = Sets.newHashSet(localDateTS.times());
    Set<LocalDate> scheduleSet = Sets.newHashSet(schedule);
    List<LocalDate> scheduledDates = Lists.newArrayList(Sets.intersection(scheduleSet, timeSeriesSet));
    Collections.sort(scheduledDates);
    List<Double> scheduledData = Lists.newArrayList();
    for (LocalDate localDate : scheduledDates) {
      scheduledData.add(localDateTS.getValue(localDate));
    }
    return ImmutableLocalDateDoubleTimeSeries.of(scheduledDates, scheduledData);
  }

}