Exemple #1
0
 @Override
 public boolean test(Object owner) {
   for (Criteria c : expressions) {
     if (c.test(owner)) {
       return true;
     }
   }
   return false;
 }
Exemple #2
0
  public static <T> List<T> filter(Collection<T> items, Criteria exp) {
    if (items.size() == 0) {
      return Collections.EMPTY_LIST;
    }

    List<T> results = new ArrayList<>();
    for (T item : items) {
      if (exp.test(item)) {
        results.add(item);
      }
    }
    return results;
  }
Exemple #3
0
 public static boolean test(Object obj, Criteria exp) {
   return exp.test(obj);
 }