src/main/java/com/conveyal/gtfs/GTFSFeed.java
public void findPatterns () {
        PatternFinder patternFinder = new PatternFinder();
        // Iterate over trips and process each trip and its stop times.
        for (Trip trip : this.trips.values()) {
            Iterable<StopTime> orderedStopTimesForTrip = this.getOrderedStopTimesForTrip(trip.trip_id);
            patternFinder.processTrip(trip, orderedStopTimesForTrip);
        }
        Map<TripPatternKey, Pattern> patternObjects = patternFinder.createPatternObjects(this.stops, null);
        this.patterns.putAll(patternObjects.values().stream()
                .collect(Collectors.toMap(Pattern::getId, pattern -> pattern)));
    }
public void findPatterns () {
        PatternFinder patternFinder = new PatternFinder();
        // Iterate over trips and process each trip and its stop times.
        for (Trip trip : this.trips.values()) {
            Iterable<StopTime> orderedStopTimesForTrip = this.getOrderedStopTimesForTrip(trip.trip_id);
            patternFinder.processTrip(trip, orderedStopTimesForTrip);
        }
        Map<TripPatternKey, Pattern> patternObjects = patternFinder.createPatternObjects(this.stops, null);
        this.patterns.putAll(patternObjects.values().stream()
                .collect(Collectors.toMap(Pattern::getId, pattern -> pattern)));
    }
public void findPatterns ( ) { PatternFinder patternFinder = new PatternFinder ( ) ; // Iterate over trips and process each trip and its stop times. for ( Trip trip : this . trips . values ( ) ) { Iterable < StopTime > orderedStopTimesForTrip = this . getOrderedStopTimesForTrip ( trip . trip_id ) ; patternFinder . processTrip ( trip , orderedStopTimesForTrip ) ; } Map < TripPatternKey , Pattern > patternObjects = patternFinder . createPatternObjects ( this . stops , null ) ; this . patterns . putAll ( patternObjects . values ( ) . stream ( ) . collect ( Collectors . toMap ( Pattern :: getId , pattern -> pattern ) ) ) ; }
MapDB-based implementation to find patterns.

FIXME: Remove and make pattern finding happen during validation? We want to share the pattern finder between the
two implementations (MapDB and RDBMS), apply the same validation process to both kinds of storage, and produce
Patterns in the same way in both cases, during validation. This prevents us from iterating over every stopTime
twice, since we're already iterating over all of them in validation. However, in this case it might not be costly
to simply retrieve the stop times from the stop_times map.
MapDB - based implementation to find patterns .