code: private void fillToTheEnd() {
          if (timeSeries.getEndIndex() >= values.size()) {
              Decimal lastValue = values.get(values.size() - 1);
              values.addAll(Collections.nCopies(timeSeries.getEndIndex() - values.size() + 1, lastValue));
          }
      }
docs: Fills with last value till the end of the series.