All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.psjava.formula.MaxInIterable Maven / Gradle / Ivy

The newest version!
package org.psjava.formula;

import java.util.Comparator;

import org.psjava.util.AssertStatus;

public class MaxInIterable {

	public static  T max(Iterable iterable, Comparator comp) {
		T max = null;
		for (T a : iterable)
			if (max == null || comp.compare(max, a) < 0)
				max = a;
		AssertStatus.assertTrue(max != null, "Empty Iterable");
		return max;
	}

	private MaxInIterable() {
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy