private static boolean areCollectionsLooselyEqual(Collection<?> values1, Object values2) {
        if (values2.getClass()
                .isArray()) {
            return areCollectionLooselyEqual(values1, (Object[]) values2);
        } else if (values2 instanceof Collection<?> values) {
            if (values1.size() != values.size()) {
                return false;
            }
            Iterator<?> firstIterator = values1.iterator();
            Iterator<?> secondIterator = values.iterator();
            while (firstIterator.hasNext()) {
                if (!areTwoObjectsLooselyEqual(firstIterator.next(), secondIterator.next())) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
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