public IntervalAllocationsAlignedToStopsIterator(M allocationDuration, List<? extends BaseInterval<K>> values, Metric<K,M> metric) {
            
            this.metric = metric;
            this.allocationDuration = allocationDuration;
            this.values = values;

            startPoint = values.get(0).getStart();
            startValuesIndex = 0;
            
            endPoint = metric.add(startPoint, allocationDuration);
            endValuesIndex = 0;
            // find interval where is end point
            while(endValuesIndex < values.size() && values.get(endValuesIndex).getEnd().compareTo(endPoint) <= 0) { endValuesIndex++; }
        }