fr.lirmm.boreal.util.validator.Validator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integraal-util Show documentation
Show all versions of integraal-util Show documentation
Util objects for integraal
The newest version!
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 the elements respect a implementation defined property
*/
default boolean check(Collection extends T> elements) {
return elements.stream().allMatch(this::check);
}
/**
* @param element element to check
* @return true iff the element respect a implementation defined property
*/
boolean check(T element);
}