How to sort a list of element objects by value?

There's an array list ArrayList
list. The Article object has a variable date. How to sort the objects in the list by value date - first earlier, and in the end older?
June 7th 19 at 14:28
1 answer
June 7th 19 at 14:30
list.sort(Comparator.comparing(Article::getPubDate));

Find more questions by tags Java