What is the purpose of sorted method of stream in Java 8?
The 'sorted' method is used to sort the stream.