@ SuppressWarnings ( "unchecked" ) public < E extends T > T [ ] concat ( T [ ] oldArray , E newElement ) { T [ ] arr = ( T [ ] ) Array . newInstance ( type , oldArray . length + 1 ) ; System . arraycopy ( oldArray , 0 , arr , 0 , oldArray . length ) ; arr [ oldArray . length ] = newElement ; return arr ; }
Returns a new instance with the given element at the end .