public static <K, V> void removeEntriesByValues(Map<K, V> map, Collection<V> values) {
        if (map.isEmpty()) {
            return;
        }
        Iterator<Map.Entry<K, V>> iterator = map.entrySet()
                .iterator();
        while (iterator.hasNext()) {
            Map.Entry<K, V> entry = iterator.next();
            if (values.contains(entry.getValue())) {
                iterator.remove();
            }
        }
    }
Note that the method only checks the immutable classes used by Turms.
turms-server-common/src/main/java/im/turms/server/common/infra/collection/CollectionUtil.java