public static <T> Collector<T, ?, MinMax<T>>
	toMinMax(final Comparator<? super T> comparator) {
		requireNonNull(comparator);
		return Collector.of(
			() -> MinMax.of(comparator),
			MinMax::accept,
			MinMax::combine
		);
	}
public static < T > Collector < T , ? , MinMax < T > > toMinMax ( final Comparator < ? super T > comparator ) { requireNonNull ( comparator ) ; return Collector . of ( ( ) -> MinMax . of ( comparator ) , MinMax :: accept , MinMax :: combine ) ; }
Return a {@code Collector} which calculates the minimum and maximum value.
The given {@code comparator} is used for comparing two objects.

<pre>{@code
final Comparator<SomeObject> comparator = ...
final Stream<SomeObject> stream = ...
final MinMax<SomeObject> moments = stream
.collect(doubleMoments.toMinMax(comparator));
}</pre>

@param comparator the {@code Comparator} to use
@param <T> the type of the input elements
@return a {@code Collector} implementing the min-max reduction
@throws java.lang.NullPointerException if the given {@code mapper} is
{@code null}