public static <T> List<T> toList(Collection<T> collection) {
        if (collection instanceof List<T> list) {
            return list;
        }
        if (collection.isEmpty()) {
            return Collections.emptyList();
        }
        return new ArrayList<>(collection);
    }
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