T
T
TheBrightside2019-11-10 12:29:12
Java
TheBrightside, 2019-11-10 12:29:12

How to sort a list by name?

I want to sort LinkedList tasks; Task is a class that contains three fields: nameTask, content and id. I want to sort the list by nameTask. That is, if I write the letter A to the console, then I should get all the tasks with the name starting with A.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2019-11-10
@myjcom

the brightside ,

that is, if I write the letter A to the console, then I should get all the tasks with the name starting with A.
It's not sorting.
https://www.mkyong.com/java8/java-8-streams-filter...
https://rextester.com/RKDQZ85663

I
illuzor, 2019-11-10
@iLLuzor

Through the static sort() method of the Collections class.
You need to pass your own Comparator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question