public static <T, K> void notRepeated(List<T> list, F<T, K> f) {
        if (list == null || list.size() == 0) {
            return;
        }
        HashSet<K> set = new HashSet<>(list.size());
        for (T t : list) {
            K k = f.f(t);
            if (!set.add(k)) {
                throw new IllegalStateException(String.format("Duplicated %s", k));
            }
        }
    }
{@link java.util.function.Function} to {@link com.google.common.base.Function}.
indexr-common/src/main/java/io/indexr/util/Trick.java