ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
Q No: 17: How do you merge two integer arrays into a single sorted array?Code:===== int[] array1 = { 1, 3, 32, 5, 7 }; int[] array2 = { 2, 4, 6, 62, 8 }; IntStream.concat(Arrays.stream(array1), Arrays.stream(array2)). sorted(). forEach(System.out::println);
List list1 = Arrays.asList(1,2,3,4,5,6); List list2 = Arrays.asList(7,8,9,10,55); Stream .concat(Stream.concat(list1.stream(), list2.stream()), Stream.concat(list1.stream(), list2.stream())) .forEach(System.out::println);;
Q No: 17: How do you merge two integer arrays into a single sorted array?
Code:
=====
int[] array1 = { 1, 3, 32, 5, 7 };
int[] array2 = { 2, 4, 6, 62, 8 };
IntStream.concat(Arrays.stream(array1), Arrays.stream(array2)).
sorted().
forEach(System.out::println);
List list1 = Arrays.asList(1,2,3,4,5,6);
List list2 = Arrays.asList(7,8,9,10,55);
Stream
.concat(Stream.concat(list1.stream(), list2.stream()), Stream.concat(list1.stream(), list2.stream()))
.forEach(System.out::println);;