/** * Creates an instance of {@link ObjectGenerator} which generates specified values distributed by their weights. * * @param pairs List of values with corresponding weights. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates specified values distributed by their weights. */ @SafeVarargs public static <T> ObjectGenerator<T> weighted(WeightPair<T>... pairs) { return weighted(Arrays.asList(pairs)); }
/** * Creates an instance of {@link ObjectGenerator} which generates specified values distributed by their weights. * * @param pairs List of values with corresponding weights. * @param <T> Type instance of {@link ObjectGenerator} will generate. * @return An instance of {@link ObjectGenerator} which generates specified values distributed by their weights. */ @SafeVarargs public static <T> ObjectGenerator<T> weighted(WeightPair<T>... pairs) { return weighted(Arrays.asList(pairs)); }