public Geometry getMergedBuffers() {
        if (this.mergedBuffers == null) {
//            synchronized (this) {
                Collection<Geometry> polygons = new ArrayList<>();
                for (Stop stop : this.stops.values()) {
                    if (getStopTimesForStop(stop.stop_id).isEmpty()) {
                        continue;
                    }
                    if (stop.stop_lat > -1 && stop.stop_lat < 1 || stop.stop_lon > -1 && stop.stop_lon < 1) {
                        continue;
                    }
                    Point stopPoint = gf.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat));
                    Polygon stopBuffer = (Polygon) stopPoint.buffer(.01);
                    polygons.add(stopBuffer);
                }
                Geometry multiGeometry = gf.buildGeometry(polygons);
                this.mergedBuffers = multiGeometry.union();
                if (polygons.size() > 100) {
                    this.mergedBuffers = DouglasPeuckerSimplifier.simplify(this.mergedBuffers, .001);
                }
//            }
        }
        return this.mergedBuffers;
    }
public Geometry getMergedBuffers() {
        if (this.mergedBuffers == null) {

                Collection<Geometry> polygons = new ArrayList<>();
                for (Stop stop : this.stops.values()) {
                    if (getStopTimesForStop(stop.stop_id).isEmpty()) {
                        continue;
                    }
                    if (stop.stop_lat > -1 && stop.stop_lat < 1 || stop.stop_lon > -1 && stop.stop_lon < 1) {
                        continue;
                    }
                    Point stopPoint = gf.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat));
                    Polygon stopBuffer = (Polygon) stopPoint.buffer(.01);
                    polygons.add(stopBuffer);
                }
                Geometry multiGeometry = gf.buildGeometry(polygons);
                this.mergedBuffers = multiGeometry.union();
                if (polygons.size() > 100) {
                    this.mergedBuffers = DouglasPeuckerSimplifier.simplify(this.mergedBuffers, .001);
                }

        }
        return this.mergedBuffers;
    }
public Geometry getMergedBuffers ( ) { if ( this . mergedBuffers == null ) { //            synchronized (this) { Collection < Geometry > polygons = new ArrayList <> ( ) ; for ( Stop stop : this . stops . values ( ) ) { if ( getStopTimesForStop ( stop . stop_id ) . isEmpty ( ) ) { continue ; } if ( stop . stop_lat > - 1 && stop . stop_lat < 1 || stop . stop_lon > - 1 && stop . stop_lon < 1 ) { continue ; } Point stopPoint = gf . createPoint ( new Coordinate ( stop . stop_lon , stop . stop_lat ) ) ; Polygon stopBuffer = ( Polygon ) stopPoint . buffer ( .01 ) ; polygons . add ( stopBuffer ) ; } Geometry multiGeometry = gf . buildGeometry ( polygons ) ; this . mergedBuffers = multiGeometry . union ( ) ; if ( polygons . size ( ) > 100 ) { this . mergedBuffers = DouglasPeuckerSimplifier . simplify ( this . mergedBuffers , .001 ) ; } //            } } return this . mergedBuffers ; }
TODO: code review
TODO : code review