/**
  * Returns the index in the provided infoList for the first non-negative arrival ETA in the list,
  * or -1 if no non-negative ETAs exist in the list
  *
  * @param infoList list to search for non-negative arrival times, ordered by relative ETA from
  *     negative infinity to positive infinity
  * @return the index in the provided infoList for the first non-negative arrival ETA in the list,
  *     or -1 if no non-negative ETAs exist in the list
  */
 public static int findFirstNonNegativeArrival(ArrayList<ArrivalInfo> infoList) {
   for (int i = 0; i < infoList.size(); i++) {
     ArrivalInfo info = infoList.get(i);
     if (info.getEta() >= 0) {
       return i;
     }
   }
   // We didn't find any non-negative ETAs
   return -1;
 }
  /**
   * Format the arrival info for speach
   *
   * @param arrivals arrival information
   * @param arrivalScanMins number of minutes ahead that the arrival information was requested for
   * @param currentTime the time when this arrival information was generated
   * @return the arrival info text formatted for speech
   */
  public static String getArrivalText(
      ObaArrivalInfo[] arrivals, int arrivalScanMins, long currentTime) {
    String output;

    if (arrivals.length == 0) {
      output =
          "There are no upcoming arrivals at your stop for the next "
              + arrivalScanMins
              + " minutes.";
    } else {
      StringBuilder sb = new StringBuilder();
      for (ObaArrivalInfo obaArrival : arrivals) {
        log.info("Arrival: " + obaArrival);
        ArrivalInfo arrival = new ArrivalInfo(obaArrival, currentTime, false);
        sb.append(arrival.getLongDescription() + " -- "); // with pause between sentences
      }
      output = sb.toString();
    }
    return output;
  }