openrtb-core/src/main/java/com/google/openrtb/util/ProtoUtils.java
public static <M extends MessageLiteOrBuilder>
      List<M> filter(List<M> objs, Predicate<M> filter) {
    checkNotNull(filter);

    for (int i = 0; i < objs.size(); ++i) {
      if (!filter.test(objs.get(i))) {
        // At least one discarded object, go to slow-path.
        return filterFrom(objs, filter, i);
      }
    }

    // Optimized common case: all items filtered, return the input sequence.
    return objs;
  }
public static <M extends MessageLiteOrBuilder>
      List<M> filter(List<M> objs, Predicate<M> filter) {
    checkNotNull(filter);

    for (int i = 0; i < objs.size(); ++i) {
      if (!filter.test(objs.get(i))) {
        // At least one discarded object, go to slow-path.
        return filterFrom(objs, filter, i);
      }
    }

    // Optimized common case: all items filtered, return the input sequence.
    return objs;
  }
Runs a filter through a sequence of objects.

@param objs Message-or-builder objects
@param filter Function that returns {@code true} to retain an object, {@code false} to discard
@return Retained objects. If some elements are retained and others are discarded,
this will be a new, mutable {@link List} that contains only the retained elements.
If all elements are retained, returns the same, unmodified input sequence.
If all elements are discarded, returns an immutable, empty sequence