class CollectionUtils
{
    /**
     * Returns a stateful stream filter that, once applied to a stream, returns a stream consisting
     * of the distinct elements (according to the specified key).
     * <p>
     * The implementation of {@link Stream#distinct()} can be used to return a stream that has distinct
     * elements, based on the implementation of {@link Object#equals(Object)}. That implementation does
     * not allow to filter a stream based on one property of each object. The implementation of provided
     * by this method does.
     *
     * @param keyExtractor A function to extract the desired key from the stream objects (cannot be null).
     * @param <T>          Stream element type.
     * @return A filter
     * @see <a href="https://stackoverflow.com/questions/27870136/java-lambda-stream-distinct-on-arbitrary-key">Stack Overflow: Java Lambda Stream Distinct() on arbitrary key?</a>
     */
    public static <T> Predicate<T> distinctByKey( Function<? super T, Object> keyExtractor )
    {<FILL_FUNCTION_BODY>}

    /**
     * Returns all elements that occur more than exactly once in the combination of all elements from all provided
     * collections.
     *
     * @param collections The collection for which to return duplicates
     * @param <V> The type of the entities in the collections.
     * @return The duplicates
     */
    @Nonnull
    public static <V> Set<V> findDuplicates(@Nonnull final Collection<V>... collections)
    {
        final Set<V> merged = new HashSet<>();
        final Set<V> duplicates = new HashSet<>();
        for (Collection<V> collection : collections) {
            for (V o : collection) {
                if (!merged.add(o)) {
                    duplicates.add(o);
                }
            }
        }
        return duplicates;
    }
}

        final Map<Object, Boolean> seen = new ConcurrentHashMap<>();
        return t -> seen.putIfAbsent( keyExtractor.apply( t ), Boolean.TRUE ) == null;
    
<no_super_class>