L
L
Lordao2018-03-03 14:46:20
Java
Lordao, 2018-03-03 14:46:20

How to sort list element from objects by value?

There is a list array ArrayList<Article> list. The Article object has a date variable. How to sort these objects in list by date value - oldest first and oldest last?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-03-03
@Lordao

list.sort(Comparator.comparing(Article::getPubDate));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question