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 .