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

fr.lirmm.boreal.util.validator.Validator Maven / Gradle / Ivy

package fr.lirmm.boreal.util.validator;

import java.util.Collection;

/**
 * @author Florent Tornil
 *
 * Validate a specific condition over the given elements
 * @param  the type of the elements to be checked
 */
public interface Validator {

	/**
	 * @param elements elements to check
	 * @return true iff all of the elements respect a implementation defined property
	 */
	default public boolean check(Collection elements) {
		return elements.stream().map(e -> this.check(e)).allMatch(b -> b);
	}
	
	/**
	 * @param element element to check
	 * @return true iff the element respect a implementation defined property
	 */
	public boolean check(T element);
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy