public long getTotalRevenueTimeForTrips (Collection<Trip> trips) {
        TIntList times = new TIntArrayList();
        for (Trip trip : trips) {
            StopTime first;
            StopTime last;
            Spliterator<StopTime> stopTimes = feed.getOrderedStopTimesForTrip(trip.trip_id).spliterator();;

            first = StreamSupport.stream(stopTimes, false)
                    .findFirst()
                    .orElse(null);

            last = StreamSupport.stream(stopTimes, false)
                    .reduce((a, b) -> b)
                    .orElse(null);

            if (last != null && first != null) {
                // revenue time should not include layovers at termini
                int time = last.arrival_time - first.departure_time;

                times.add(time);
            }
        }

        return times.sum();
    }
public long getTotalRevenueTimeForTrips (Collection<Trip> trips) {
        TIntList times = new TIntArrayList();
        for (Trip trip : trips) {
            StopTime first;
            StopTime last;
            Spliterator<StopTime> stopTimes = feed.getOrderedStopTimesForTrip(trip.trip_id).spliterator();;

            first = StreamSupport.stream(stopTimes, false)
                    .findFirst()
                    .orElse(null);

            last = StreamSupport.stream(stopTimes, false)
                    .reduce((a, b) -> b)
                    .orElse(null);

            if (last != null && first != null) {
                
                int time = last.arrival_time - first.departure_time;

                times.add(time);
            }
        }

        return times.sum();
    }
public long getTotalRevenueTimeForTrips ( Collection < Trip > trips ) { TIntList times = new TIntArrayList ( ) ; for ( Trip trip : trips ) { StopTime first ; StopTime last ; Spliterator < StopTime > stopTimes = feed . getOrderedStopTimesForTrip ( trip . trip_id ) . spliterator ( ) ; ; first = StreamSupport . stream ( stopTimes , false ) . findFirst ( ) . orElse ( null ) ; last = StreamSupport . stream ( stopTimes , false ) . reduce ( ( a , b ) -> b ) . orElse ( null ) ; if ( last != null && first != null ) { // revenue time should not include layovers at termini int time = last . arrival_time - first . departure_time ; times . add ( time ) ; } } return times . sum ( ) ; }
Get total revenue time (in seconds) for set of trips.
@param trips
@return total revenue time (in seconds)
Get total revenue time ( in seconds ) for set of trips .