-2

How can I sort an ArrayList of type: List<Map<String, Object>> according to a property of that list, when I have the properties in the right order as a String?

e.g. I have a big list containing of ids and names. And I have the ids in the wanted order in a string. How can I order the list according to the string?

1
  • 3
    Searching for "java sort list" gives lots of Q&A. Downvoting for failing to do any basic searching. Commented Apr 11, 2017 at 11:51

1 Answer 1

2

You can refer the following StackOverflow post.

In summary, you could create a Comparator for the corresponding class; or implement the Comparable interface.

Sign up to request clarification or add additional context in comments.

4 Comments

The word duplicate in there indicates that well, duplicates are around. Putting up an answer that only links to another answer, sorry, that is, well, lame?!
@GhostCat i'm a newbie in answering stackoverflow questions.... i'll take the criticism constructively... thanks
I like your attitude. I reworded the answer a bit, and upvoted; just to appreciate that!
@GhostCat :) thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.