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

org.joo.libra.support.functions.MinFunction Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.joo.libra.support.functions;

import java.util.Arrays;

import org.joo.libra.PredicateContext;

public class MinFunction implements MultiArgsFunction {

	@Override
	public Object apply(PredicateContext context, Object[] t) {
		if (t == null || t.length == 0)
			throw new IllegalArgumentException("MIN function must have at least one argument");
		return Arrays.stream(t).map(number -> (Number) number).mapToDouble(number -> number.doubleValue()).min()
				.getAsDouble();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy