Create a filter based on a Prefer header
@param prefer the Prefer header
@return a suitable predicate for filtering a stream of quads
185703
public static Predicate<Quad> filterWithPrefer(final Prefer prefer) {
        final Set<String> include = new HashSet<>(DEFAULT_REPRESENTATION);
        ofNullable(prefer).ifPresent(p -> {
            p.getOmit().forEach(include::remove);
            p.getInclude().forEach(include::add);
        });
        return quad -> quad.getGraphName().filter(x -> x instanceof IRI).map(x -> (IRI) x)
            .map(IRI::getIRIString).filter(include::contains).isPresent();
    }
830790
public LoadBalancerPoolFilter loadBalancerPools(LoadBalancerPool... loadBalancerPools) {
        predicate = predicate.and(Filter.or(
                Streams.map(loadBalancerPools, LoadBalancerPool::asFilter)
        ).getPredicate());

        return this;
    }
1186576
public static <T> Iterable<T> filter(final Iterable<T> sequence,
                                         final Predicate<? super T> filter) {
        return new Iterable<T>() {
            @Override
            public Iterator<T> iterator() {
                return new FilteringIterator<T>(sequence.iterator(), filter);
            }
        };
    }
28151
@Override
   public CacheStream<R> filter(Predicate<? super R> predicate) {
      return addIntermediateOperation(new FilterOperation<>(predicate));
   }
19879
public static Prefer valueOf(final String value) {
        if (nonNull(value)) {
            final Map<String, String> data = new HashMap<>();
            final Set<String> params = new HashSet<>();
            stream(value.split(";")).map(String::trim).map(pref -> pref.split("=", 2)).forEach(x -> {
                if (x.length == 2) {
                    data.put(x[0].trim(), x[1].trim());
                } else {
                    params.add(x[0].trim());
                }
            });
            final String waitValue = data.get(PREFER_WAIT);
            try {
                Integer wait = null;
                if (nonNull(waitValue)) {
                    wait = parseInt(waitValue);
                }
                return new Prefer(data.get(PREFER_RETURN), parseParameter(data.get(PREFER_INCLUDE)),
                        parseParameter(data.get(PREFER_OMIT)), params, data.get(PREFER_HANDLING), wait);
            } catch (final NumberFormatException ex) {
                LOGGER.error("Cannot parse wait parameter value {}: {}", waitValue, ex.getMessage());
            }
        }
        return null;
    }
1227864
public static <E> Filter<E> switchedFilter(Filter<E> filter, boolean negated) {
    return (new NegatedFilter<E>(filter, negated));
  }
696406
public VariantAvroFilters addFilter(String filters) {
        String[] filtersSplit = filters.split(";");
        return addFilter(filtersSplit);
    }
296125
public FirewallPolicyFilter dataCentersWhere(Predicate<DataCenterMetadata> predicate) {
        checkNotNull(predicate, "Predicate must be not a null");

        dataCenterFilter.where(predicate);
        return this;
    }
994876
private CmsWorkplaceEditorConfiguration filterPreferredEditor(String preferredEditor) {

        if (m_preferredEditors.size() == 0) {
            Iterator<CmsWorkplaceEditorConfiguration> i = m_editorConfigurations.iterator();
            while (i.hasNext()) {
                CmsWorkplaceEditorConfiguration currentConfig = i.next();
                m_preferredEditors.put(currentConfig.getEditorUri(), currentConfig);
            }
        }
        return m_preferredEditors.get(preferredEditor);
    }
117353
public Graph<K, VV, EV> filterOnVertices(FilterFunction<Vertex<K, VV>> vertexFilter) {

		DataSet<Vertex<K, VV>> filteredVertices = this.vertices.filter(vertexFilter);

		DataSet<Edge<K, EV>> remainingEdges = this.edges.join(filteredVertices)
				.where(0).equalTo(0).with(new ProjectEdge<>())
				.join(filteredVertices).where(1).equalTo(0)
				.with(new ProjectEdge<>()).name("Filter on vertices");

		return new Graph<>(filteredVertices, remainingEdges, this.context);
	}
665548
public List<InetAddress> getSortedListByProximity(InetAddress address, Collection<InetAddress> unsortedAddress)
    {
        List<InetAddress> preferred = new ArrayList<InetAddress>(unsortedAddress);
        sortByProximity(address, preferred);
        return preferred;
    }
710109
@NotNull
    public LongStream filterNot(@NotNull final LongPredicate predicate) {
        return filter(LongPredicate.Util.negate(predicate));
    }
949137
public Graph<K, VV, EV> filterOnEdges(FilterFunction<Edge<K, EV>> edgeFilter) {
		DataSet<Edge<K, EV>> filteredEdges = this.edges.filter(edgeFilter).name("Filter on edges");

		return new Graph<>(this.vertices, filteredEdges, this.context);
	}
1063322
public static String buildEtagHash(final String identifier, final Instant modified, final Prefer prefer) {
        final String sep = ".";
        final String hash = prefer != null ? prefer.getInclude().hashCode() + sep + prefer.getOmit().hashCode() : "";
        return md5Hex(modified.toEpochMilli() + sep + modified.getNano() + sep + hash + sep + identifier);
    }
653531
@CheckResult @NonNull
  public static RxSharedPreferences create(@NonNull SharedPreferences preferences) {
    checkNotNull(preferences, "preferences == null");
    return new RxSharedPreferences(preferences);
  }
896848
@Override
	public M filter(BiPredicate<? super K, ? super V> filter) {
		MapBuilder<K, V, M> builder = builder();
		for (java.util.Map.Entry<K, V> entry : entrySet()) {
			if(filter.test(entry.getKey(), entry.getValue())) {
				builder.put(entry.getKey(), entry.getValue());
			}
		}
		return builder.build();
	}
1771
public Optional<T> filter(final Predicate<? super T> predicate) {
        if (isPresent() && predicate.test(get())) {
            return this;
        }

        return empty();
    }