Created
July 20, 2016 00:47
-
-
Save morishjs/da7c123d728fa6cdc2e4bbc7ad1e53f4 to your computer and use it in GitHub Desktop.
using concat feature.
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
package java0720_api; | |
import java.util.Arrays; | |
import java.util.stream.IntStream; | |
/** | |
* Created by Junsuk on 2016-07-20. | |
*/ | |
public class Java142_System { | |
public static void main(String[] args) { | |
int[] arr1 = {1, 5, 2, 4}; | |
int[] arr2 = {6, 3, 9, 7, 8}; | |
int[] arr3 = process(arr1, arr2); | |
for (int data : | |
arr3) { | |
System.out.printf("%3d", data); | |
} | |
} | |
public static int[] process(int[] arr1, int[] arr2) { | |
int[] arr3; | |
IntStream intStream = Arrays.stream(arr1); | |
IntStream intStream2 = Arrays.stream(arr2); | |
arr3 = IntStream.concat(intStream, intStream2).toArray(); | |
return arr3; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment