public static <T> Collector<T, ?, Quantile> toQuantile(
		final double quantile,
		final ToDoubleFunction<? super T> mapper
	) {
		check(quantile);
		requireNonNull(mapper);

		return Collector.of(
			() -> new Quantile(quantile),
			(r, t) -> r.accept(mapper.applyAsDouble(t)),
			Quantile::combine
		);
	}
Return a {@code Collector} which applies a double-producing mapping
function to each input element, and returns quantiles for the resulting
values.
{@snippet lang="java":
final Stream<SomeObject> stream = null; // @replace substring='null' replacement="..."
final Quantile quantile = stream
    .collect(toQuantile(0.25, v -> v.doubleValue()));
}

@param quantile the wished quantile value.
@param mapper a mapping function to apply to each element
@param <T> the type of the input elements
@return a {@code Collector} implementing the quantile reduction
@throws java.lang.NullPointerException if the given {@code mapper} is
        {@code null}
@throws IllegalArgumentException if the {@code quantile} is not in the
        range {@code [0, 1]}.
jenetics/src/main/java/io/jenetics/stat/Quantile.java