Created
October 15, 2014 16:06
-
-
Save czxttkl/990b61b41eed4085f649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("unchecked") | |
public static <T> T[] concatArrays8(T[] arr1, T[] arr2) { | |
T[] both = (T[])Array.newInstance(arr1.getClass().getComponentType(), arr1.length+arr2.length); | |
Object[] bothObj = Stream.concat(Arrays.stream(arr1), Arrays.stream(arr2)).toArray(); | |
for (int i = 0; i < both.length; i++) { | |
both[i] = (T)bothObj[i]; | |
} | |
return both; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment