private static boolean requiresWrap(Collection collection) {
        for (Object value : collection) {
            if (value instanceof Collection || value instanceof Map) {
                return true;
            }
        }
        return false;
    }
private static boolean requiresWrap ( Collection collection ) { for ( Object value : collection ) { if ( value instanceof Collection || value instanceof Map ) { return true ; } } return false ; }
Checks whether a collection requires any wrapping. This is used to avoid creating a copy of a
collection if all of its fields can be handled natively.

@param collection The collection to check for values that require wrapping.
@return {@code true} if the collection contains values that need to be wrapped (i.e. maps or
collections), otherwise {@code false}.