/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 */
package org.jenetics.stat;

import static org.jenetics.internal.math.statistics.max;
import static org.jenetics.internal.math.statistics.min;

import java.util.function.Consumer;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @since 3.0
 * @version 3.0 &mdash; <em>$Date: 2014-04-29 $</em>
 */
public class MinMax<C extends Comparable<? super C>> implements Consumer<C> {

	private C _min;
	private C _max;

	@Override
	public void accept(final C object) {
		_min = min(_min, object);
		_max = max(_max, object);
	}

	public void combine(final MinMax<C> other) {
		_min = min(_min, other._min);
		_max = max(_max, other._max);
	}

	public C getMin() {
		return _min;
	}

	public C getMax() {
		return _max;
	}

}

@@ -912,16 +912,51 @@
 onsumer;
+%0Aimport java.util.stream.Collector;
 %0A%0A/**%0A *
@@ -1094,12 +1094,12 @@
 14-0
-4-29
+5-05
  $%3C/
@@ -1500,24 +1500,24 @@
  getMax() %7B%0A
-
 %09%09return _ma
@@ -1523,10 +1523,791 @@
 ax;%0A%09%7D%0A%0A
+%09/**%0A%09 * Return a %7B@code Collector%7D which applies an long-producing mapping%0A%09 * function to each input element, and returns moments-statistics for the%0A%09 * resulting values.%0A%09 *%0A%09 * %5Bcode%5D%0A%09 * final Stream&lt;SomeObject&gt; stream = ...%0A%09 * final MinMax&lt;SomeObject&gt; moments = stream%0A%09 *     .collect(doubleMoments.collector());%0A%09 * %5B/code%5D%0A%09 *%0A%09 * @param %3CC%3E the type of the input elements%0A%09 * @return a %7B@code Collector%7D implementing the moments-statistics reduction%0A%09 * @throws java.lang.NullPointerException if the given %7B@code mapper%7D is%0A%09 *         %7B@code null%7D%0A%09 */%0A%09public static %3CC extends Comparable%3C? super C%3E%3E%0A%09Collector%3CC, ?, MinMax%3CC%3E%3E collector() %7B%0A%09%09return Collector.of(%0A%09%09%09MinMax::new,%0A%09%09%09(r, t) -%3E r.accept(t),%0A%09%09%09(a, b) -%3E %7Ba.combine(b); return a;%7D%0A%09%09);%0A%09%7D%0A%0A
 %7D%0A

Add javadoc.