@ SuppressWarnings ( "AutoBoxing" ) protected Collection < T > convertPrimitiveArrayToCollection ( final Object value , final Class primitiveComponentType ) { Collection < T > result = null ; if ( primitiveComponentType == int . class ) { int [ ] array = ( int [ ] ) value ; result = createCollection ( array . length ) ; for ( int a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == long . class ) { long [ ] array = ( long [ ] ) value ; result = createCollection ( array . length ) ; for ( long a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == float . class ) { float [ ] array = ( float [ ] ) value ; result = createCollection ( array . length ) ; for ( float a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == double . class ) { double [ ] array = ( double [ ] ) value ; result = createCollection ( array . length ) ; for ( double a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == short . class ) { short [ ] array = ( short [ ] ) value ; result = createCollection ( array . length ) ; for ( short a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == byte . class ) { byte [ ] array = ( byte [ ] ) value ; result = createCollection ( array . length ) ; for ( byte a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == char . class ) { char [ ] array = ( char [ ] ) value ; result = createCollection ( array . length ) ; for ( char a : array ) { result . add ( convertType ( a ) ) ; } } else if ( primitiveComponentType == boolean . class ) { boolean [ ] array = ( boolean [ ] ) value ; result = createCollection ( array . length ) ; for ( boolean a : array ) { result . add ( convertType ( a ) ) ; } } return result ; }
Converts primitive array to target collection .