Botre Posted April 9, 2016 Posted April 9, 2016 (edited) A very basic snippet, I keep seeing people rewriting negations manually way too often. Allows to you create inversions/negations of filters. Example final Filter<String> IS_EMPTY = s -> s.isEmpty(); final Filter<String> IS_NOT_EMPTY = negate(IS_EMPTY); Snippet /** * Returns a filter that represents the logical negation of the supplied filter. * * @return a filter that represents the logical negation of the supplied filter */ public static final <T> Filter<T> negate(Filter<T> filter) { return e -> !filter.match(e); } Edited April 9, 2016 by Botre 1