code: private static void removeNonApplicableFilters(
              Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy,
              EntitySpec entitySpec) {
          Set<EntitySpec> entitySpecsSet = new HashSet<>();
          Set<String> filterPropIds = new HashSet<>();
          String[] entitySpecPropIds = entitySpec.getPropositionIds();
          for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) {
              Filter f = itr.next();
              Arrays.addAll(filterPropIds, f.getPropositionIds());
              for (EntitySpec es : entitySpecs) {
                  if (Collections.containsAny(filterPropIds,
                          es.getPropositionIds())) {
                      entitySpecsSet.add(es);
                  }
              }
              if (Collections.containsAny(filterPropIds, entitySpecPropIds)) {
                  return;
              }
              if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) {
                  itr.remove();
              }
              entitySpecsSet.clear();
              filterPropIds.clear();
          }
      }
docs: Remove filters that are not directly applicable to the given entity spec
  and are not applicable to other entity specs that refer to it.
  
  @param entitySpecs
  @param filtersCopy
  @param entitySpec