/** * Creates an instance of {@link ObjectGenerator} which generates each value exactly specified number of times. * Values are generated using weighted distribution until depleted. When all values are generated specified number * of times and {@link ObjectGenerator#next()} is invoked, * {@link io.smartcat.ranger.core.ExactWeightedValue.ExactWeightedValueDepletedException * ExactWeightedValueDepletedException} is thrown. * * @param pairs List of values with corresponding count. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates each value exactly specified number of times. */ @SafeVarargs public static <T> ObjectGenerator<T> exactly(CountPair<T>... pairs) { return exactly(Arrays.asList(pairs)); }
/** * Creates an instance of {@link ObjectGenerator} which generates each value exactly specified number of times. * Values are generated using weighted distribution until depleted. When all values are generated specified number * of times and {@link ObjectGenerator#next()} is invoked, * {@link io.smartcat.ranger.core.ExactWeightedValue.ExactWeightedValueDepletedException * ExactWeightedValueDepletedException} is thrown. * * @param pairs List of values with corresponding count. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates each value exactly specified number of times. */ @SafeVarargs public static <T> ObjectGenerator<T> exactly(CountPair<T>... pairs) { return exactly(Arrays.asList(pairs)); }