Как мы можем оптимизировать этот метод? 

    public void setAmount(List<RouteAmountGroup> group) {
        int totalTripSize = 0;
        int totalTransported = 0;
        double totalAverageOccupancy = 0;
        double totalMaxLoad = 0;
        int totalFwTripTransported = 0;
        int totalBwTripTransported = 0;

        for (RouteAmountGroup routeAmountGroup : group) {
            totalTripSize += routeAmountGroup.getTripSize();
            totalTransported += routeAmountGroup.getTransported();
            totalAverageOccupancy += routeAmountGroup.getAvgOccupancy();
            totalMaxLoad = Math.max((double) routeAmountGroup.getMaxOccupancy() / routeAmountGroup.getCabinCapacity() * 100.0, totalMaxLoad);
            if (routeAmountGroup.getDirectionId() == 1) {
                totalFwTripTransported += routeAmountGroup.getTransported();
            } else {
                totalBwTripTransported += routeAmountGroup.getTransported();
            }
        }

        this.tripSize = totalTripSize;
        this.transported = totalTransported;
        this.averageOccupancy = round(totalAverageOccupancy, 2);
        this.maxLoad = round(totalMaxLoad, 2);
        this.fwTripTransported = totalFwTripTransported;
        this.bwTripTransported = totalBwTripTransported;
    }
 There should be exactly 3 paragraphs separated by the markdown divider: ***.
user