public static <T, K> int repeatIndex(List<T> list, F<T, K> f) {
        if (list == null || list.size() == 0) {
            return -1;
        }
        HashSet<K> set = new HashSet<>(list.size());
        int i = 0;
        for (T t : list) {
            K k = f.f(t);
            if (!set.add(k)) {
                return i;
            }
            i++;
        }
        return -1;
    }
{@link java.util.function.Function} to {@link com.google.common.base.Function}.
indexr-common/src/main/java/io/indexr/util/Trick.java