public static Object [ ] concat ( Object array1 [ ] , Object array2 [ ] ) { Class < ? > class1 = array1 . getClass ( ) . getComponentType ( ) ; Class < ? > class2 = array2 . getClass ( ) . getComponentType ( ) ; Class < ? > commonClass = class1 . isAssignableFrom ( class2 ) ? class1 : ( class2 . isAssignableFrom ( class1 ) ? class2 : Object . class ) ; return concat ( array1 , array2 , commonClass ) ; }
Returns new array which has all values from array1 and array2 in order . The componentType for the new array is determined by the componentTypes of two arrays .