test_class.file: openrtb-core/src/test/java/com/google/openrtb/util/ProtoUtilsTest.java
test_class.identifier: ProtoUtilsTest
test_case.body: @Test
    public void testFilter() {
      Test1 test1 = Test1.newBuilder().setTest1("test1").build();
      Test2 test2 = Test2.newBuilder().setTest2("test2").build();
      BidRequest reqExt = BidRequest.newBuilder()
          .setId("0")
          .addImp(Imp.newBuilder()
              .setId("1")
              .setBanner(Banner.newBuilder()
                  .setExtension(TestExt.testBanner, test1)))
              // No extension on Imp, must recurse anyway
          .setExtension(TestExt.testRequest1, test1)
          .setExtension(TestExt.testRequest2, test2)
          .build();
      assertThat(ProtoUtils.filter(reqExt, true, fd -> true))
          .isSameInstanceAs(reqExt);
      assertThat(ProtoUtils.filter(reqExt, true, fd -> false)).isNull();
      assertThat(ProtoUtils.filter(reqExt, false, fd -> false))
          .isSameInstanceAs(BidRequest.getDefaultInstance());
  
      BidRequest reqPlainClear = BidRequest.newBuilder()
          .setId("0")
          .addImp(Imp.newBuilder().setId("1"))
          .build();
      assertThat(ProtoUtils.filter(reqExt, true, ProtoUtils.NOT_EXTENSION)).isEqualTo(reqPlainClear);
  
      BidRequest reqPlainNoClear = BidRequest.newBuilder()
          .setId("0")
          .addImp(Imp.newBuilder().setId("1")
              .setBanner(Banner.newBuilder()))
          .build();
      assertThat(ProtoUtils.filter(reqExt, false, ProtoUtils.NOT_EXTENSION))
          .isEqualTo(reqPlainNoClear);
  
      BidRequest reqExtNoImp = reqExt.toBuilder().clearImp().build();
      assertThat(ProtoUtils.filter(reqExt, false, fd -> !"imp".equals(fd.getName())))
          .isEqualTo(reqExtNoImp);
  
      BidRequest reqDiff = reqPlainClear.toBuilder().setId("1").build();
      ImmutableList<BidRequest> list = ImmutableList.of(reqPlainClear, reqDiff);
      assertThat(ProtoUtils.filter(list, req -> "0".equals(req.getId())))
          .containsExactly(reqPlainClear);
      assertThat(ProtoUtils.filter(list, req -> "0".equals(req.getId())))
          .containsExactly(reqPlainClear);
      assertThat(ProtoUtils.filter(list, req -> true)).isSameInstanceAs(list);
      assertThat(ProtoUtils.filter(list, req -> false)).isEmpty();
    }
test_case.class_method_signature: ProtoUtilsTest.testFilter()
test_case.full_signature: @Test public void testFilter()
test_case.identifier: testFilter
test_case.invocations: build setTest1 newBuilder build setTest2 newBuilder build setExtension setExtension addImp setId newBuilder setBanner setId newBuilder setExtension newBuilder isSameInstanceAs assertThat filter isNull assertThat filter isSameInstanceAs assertThat filter getDefaultInstance build addImp setId newBuilder setId newBuilder isEqualTo assertThat filter build addImp setId newBuilder setBanner setId newBuilder newBuilder isEqualTo assertThat filter build clearImp toBuilder isEqualTo assertThat filter equals getName build setId toBuilder of containsExactly assertThat filter equals getId containsExactly assertThat filter equals getId isSameInstanceAs assertThat filter isEmpty assertThat filter
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFilter()
focal_class.declarator: NOT_EXTENSION = fd -> !fd.isExtension()
focal_class.modifier: public static final
focal_class.original_string: public static final Predicate<FieldDescriptor> NOT_EXTENSION = fd -> !fd.isExtension();
focal_class.type: Predicate<FieldDescriptor>
focal_class.var_name: NOT_EXTENSION
focal_class.file: openrtb-core/src/main/java/com/google/openrtb/util/ProtoUtils.java
focal_class.identifier: ProtoUtils
focal_class.class_method_signature: ProtoUtils.ProtoUtils()
focal_class.full_signature: private  ProtoUtils()
focal_class.identifier: ProtoUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ProtoUtils()
focal_class.class_method_signature: ProtoUtils.built(@Nullable I msg)
focal_class.full_signature: @SuppressWarnings("unchecked") public static O built(@Nullable I msg)
focal_class.identifier: built
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (@Nullable I msg)
focal_class.return: O
focal_class.signature: O built(@Nullable I msg)
focal_class.class_method_signature: ProtoUtils.builder(
        @Nullable I msg)
focal_class.full_signature: @SuppressWarnings("unchecked") public static O builder(
        @Nullable I msg)
focal_class.identifier: builder
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (
        @Nullable I msg)
focal_class.return: O
focal_class.signature: O builder(
        @Nullable I msg)
focal_class.class_method_signature: ProtoUtils.update(
        Iterable<B> objs, Function<B, Boolean> updater)
focal_class.full_signature: public static boolean update(
        Iterable<B> objs, Function<B, Boolean> updater)
focal_class.identifier: update
focal_class.modifiers: public static
focal_class.parameters: (
        Iterable<B> objs, Function<B, Boolean> updater)
focal_class.return: boolean
focal_class.signature: boolean update(
        Iterable<B> objs, Function<B, Boolean> updater)
focal_class.class_method_signature: ProtoUtils.filter(List<M> objs, Predicate<M> filter)
focal_class.full_signature: public static List<M> filter(List<M> objs, Predicate<M> filter)
focal_class.identifier: filter
focal_class.modifiers: public static
focal_class.parameters: (List<M> objs, Predicate<M> filter)
focal_class.return: List<M>
focal_class.signature: List<M> filter(List<M> objs, Predicate<M> filter)
focal_class.class_method_signature: ProtoUtils.filterFrom(
        List<M> objs, Predicate<M> filter, int firstDiscarded)
focal_class.full_signature: private static List<M> filterFrom(
        List<M> objs, Predicate<M> filter, int firstDiscarded)
focal_class.identifier: filterFrom
focal_class.modifiers: private static
focal_class.parameters: (
        List<M> objs, Predicate<M> filter, int firstDiscarded)
focal_class.return: List<M>
focal_class.signature: List<M> filterFrom(
        List<M> objs, Predicate<M> filter, int firstDiscarded)
focal_class.class_method_signature: ProtoUtils.filter(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter)
focal_class.full_signature: @Nullable public static M filter(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter)
focal_class.identifier: filter
focal_class.modifiers: @Nullable public static
focal_class.parameters: (
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter)
focal_class.return: M
focal_class.signature: M filter(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter)
focal_class.class_method_signature: ProtoUtils.filterFrom(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter, int first, boolean discard)
focal_class.full_signature: @Nullable private static M filterFrom(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter, int first, boolean discard)
focal_class.identifier: filterFrom
focal_class.modifiers: @Nullable private static
focal_class.parameters: (
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter, int first, boolean discard)
focal_class.return: M
focal_class.signature: M filterFrom(
        M msg, boolean clearEmpty, Predicate<FieldDescriptor> filter, int first, boolean discard)
focal_class.class_method_signature: ProtoUtils.filterValue(boolean clearEmpty, Predicate<FieldDescriptor> filter,
        Message.Builder builder, Map.Entry<FieldDescriptor, Object> entry)
focal_class.full_signature: protected static boolean filterValue(boolean clearEmpty, Predicate<FieldDescriptor> filter,
        Message.Builder builder, Map.Entry<FieldDescriptor, Object> entry)
focal_class.identifier: filterValue
focal_class.modifiers: protected static
focal_class.parameters: (boolean clearEmpty, Predicate<FieldDescriptor> filter,
        Message.Builder builder, Map.Entry<FieldDescriptor, Object> entry)
focal_class.return: boolean
focal_class.signature: boolean filterValue(boolean clearEmpty, Predicate<FieldDescriptor> filter,
        Message.Builder builder, Map.Entry<FieldDescriptor, Object> entry)
focal_method.body: 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;
    }
focal_method.class_method_signature: ProtoUtils.filter(List<M> objs, Predicate<M> filter)
focal_method.full_signature: public static List<M> filter(List<M> objs, Predicate<M> filter)
focal_method.identifier: filter
focal_method.invocations: checkNotNull size test get filterFrom
focal_method.modifiers: public static
focal_method.parameters: (List<M> objs, Predicate<M> filter)
focal_method.return: List<M>
focal_method.signature: List<M> filter(List<M> objs, Predicate<M> filter)