public static <T> Set<T> intersection(Set<T> c1, Collection<T> c2) {
        int size1 = c1.size();
        int size2 = c2.size();
        if (size1 == 0 || size2 == 0) {
            return Collections.emptySet();
        }
        Set<T> result = newSetWithExpectedSize(Math.min(size1, size2));
        for (T value : c2) {
            if (c1.contains(value)) {
                result.add(value);
            }
        }
        return result;
    }
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