@ Nonnull @ ReturnsMutableCopy public static < ELEMENTTYPE > ELEMENTTYPE [ ] getConcatenated ( @ Nullable final ELEMENTTYPE aHead , @ Nullable final ELEMENTTYPE [ ] aTailArray , @ Nonnull final Class < ELEMENTTYPE > aClass ) { if ( isEmpty ( aTailArray ) ) return newArraySingleElement ( aHead , aClass ) ; // Start concatenating final ELEMENTTYPE [ ] ret = newArray ( aClass , 1 + aTailArray . length ) ; ret [ 0 ] = aHead ; System . arraycopy ( aTailArray , 0 , ret , 1 , aTailArray . length ) ; return ret ; }
Get a new array that combines the passed head and the array . The head element will be the first element of the created array .