code: static <T> Predicate<T> createMostSpecificMatchPredicate(final Iterable<T> source,
        final Function<T, Class<?>> toClass) {
      return input -> {
        final Class<?> inputClass = toClass.apply(input);
        for (final Class<?> match : Iterables.transform(source, toClass)) {
          if (!inputClass.equals(match) && inputClass.isAssignableFrom(match)) {
            return false;
          }
        }
        return true;
      };
    }
docs: Creates a Predicate that returns false if source contains an associated class that is a super
  type of the class associated with the tested T.
  
  @param <T> the type to test
  @param source the set of &lt;T&gt; to look for class matches.
  @param toClass Function from T to Class
  @return newly create predicate.