code: public int getDailyAverageHeadway (LocalDate date, LocalTime from, LocalTime to) {
  
          OptionalDouble avg =  feed.stops.values().stream()
                  .map(s -> this.stop.getAverageHeadwayForStop(s.stop_id, date, from, to))
                  .mapToDouble(headway -> headway)
                  .average();
  
          return (int) avg.getAsDouble();
      }
docs: in seconds