public static <T> T findBy(final Collection<T> collection, final Filter<T> filter) {
    for (T element : collection) {
      if (filter.accept(element)) {
        return element;
      }
    }

    return null;
  }
Iterates the Collection and finds all object elements that match the Filter criteria.
<p>

@param <T> the class type of the Collection elements.
@param collection the Collection of elements to iterate and filter.
@param filter the Filter applied to the Collection of elements in search of the matching
       element.
@return a single element from the Collection that match the criteria of the Filter. If multiple
        elements match the Filter criteria, then this method will return the first one. If no
        element of the Collection matches the criteria of the Filter, then this method returns
        null.
geode-core/src/main/java/org/apache/geode/internal/util/CollectionUtils.java