public static <K, V, T> Map<K, V> toMap(Collection<T> collection, Function<? super T, K> keyFunction,
        Function<? super T, V> valueFunction) {
        return stream(collection)
            .filter(Objects::nonNull)
            .collect(Collectors.toMap(keyFunction, valueFunction, (oldValue, newValue) -> newValue));
    }
Convert a set into a map. If there is a key conflict, the second one will prevail.

@param collection collection
@param keyFunction keyFunction
@param valueFunction valueFunction
@param <K> key data type
@param <V> value data type
@param <T> Data type before conversion
@return Convert to future map
chat2db-server/chat2db-server-tools/chat2db-server-tools-common/src/main/java/ai/chat2db/server/tools/common/util/EasyCollectionUtils.java