public static <T> List<T> findAll(final Collection<T> collection, final Filter<T> filter) {
    final List<T> matches = new ArrayList<>(collection.size());

    for (final T element : collection) {
      if (filter.accept(element)) {
        matches.add(element);
      }
    }

    return matches;
  }
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 all matching
       elements.
@return a List of elements from the Collection matching the criteria of the Filter in the order
        in which they were found. If no elements match the Filter criteria, then an empty List
        is returned.
geode-core/src/main/java/org/apache/geode/internal/util/CollectionUtils.java