This program sorts an array and then converts the sorted array into a Stream to print its elements.
Code Example:
import java.util.Arrays;
public class Java8 {
public static void main(String[] args) {
int arr[] = { 99, 55, 203, 99, 4, 91 };
Arrays.parallelSort(arr);
Arrays.stream(arr).forEach(n -> System.out.print(n + " "));
}
}Output:
4 55 91 99 99 203