/** * Returns a TreeSet containing tuples returned by {@code n} calls to a given Supplier {@code s}. * The underlying comparator is the natural comparator of T. * * @param <T> Component type of the TreeSet * @param n The number of elements in the TreeSet * @param s The Supplier computing element values * @return A TreeSet of size {@code n}, where each element contains the result supplied by {@code s}. * @throws NullPointerException if {@code s} is null */ public static <T extends Comparable<? super T>> TreeSet<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); return fill(Comparators.naturalComparator(), n, s); }
/** * Returns a TreeSet containing tuples returned by {@code n} calls to a given Supplier {@code s}. * The underlying comparator is the natural comparator of T. * * @param <T> Component type of the TreeSet * @param n The number of elements in the TreeSet * @param s The Supplier computing element values * @return A TreeSet of size {@code n}, where each element contains the result supplied by {@code s}. * @throws NullPointerException if {@code s} is null */ public static <T extends Comparable<? super T>> TreeSet<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); return fill(Comparators.naturalComparator(), n, s); }