package edu.ualberta.med.biobank.common.util; /** * Define a test that can be evaluated on T, the result of which is true or * false. The test can then be applied to a collection to filter out results for * which evaluate() returns false, something like: * * <pre> * final Date d1 = new Date(); * final Date d2 = new Date(); * * Predicate<AliquotWrapper> checkLinkDate = new Predicate<AliquotWrapper>() { * public boolean evaluate(AliquotWrapper aliquot) { * return aliquot.getLinkDate().after(d1) * && aliquot.getLinkDate().before(d2); * } * }; * * Collection<AliquotWrapper> filtrate = PredicateUtil.filter(aliquots, * checkLinkDate); * </pre> * * @author jferland * * @param <T> */ public interface Predicate<T> { boolean evaluate(T type); }