@ SafeVarargs public static < T > T [ ] concat ( T [ ] first , T [ ] ... rest ) { int length = first . length ; for ( T [ ] array : rest ) { length += array . length ; } T [ ] result = Arrays . copyOf ( first , length ) ; int offset = first . length ; for ( T [ ] array : rest ) { System . arraycopy ( array , 0 , result , offset , array . length ) ; offset += array . length ; } return result ; }
Concatenates several reference arrays .