code: 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
  		);
  	}
docs: Return a {@code Collector} which applies an double-producing mapping
  function to each input element, and returns quantiles for the resulting
  values.
  
  <pre>{@code
  final Stream<SomeObject> stream = ...
  final Quantile quantile = stream
  .collect(toQuantile(0.25, v -> v.doubleValue()));
  }</pre>
  
  @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 quantiles 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]}.