![Learn Selenium](https://wfqqreader-1252317822.image.myqcloud.com/cover/509/36698509/b_36698509.jpg)
上QQ阅读APP看书,第一时间看更新
Stream.sort()
We can sort a stream by calling the sort() function. Let's use the sort() function on the languages list, as shown in the following code:
languages.stream().sorted();
This will sort the elements in alphabetical order. We can provide a lambda expression to sort the elements using custom comparison logic.