Hey guys,
I am trying to sort a String Array by the length of it's elements. I found only this solution: Arrays.sort(strs, Comparator.comparing(String::length)). Is there a more 'elegant' way to do it (strs is the name of the Array)?
5 Replies
⌛
This post has been reserved for your question.
Hey @orbankaroly! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Looks good enough. "More elegant" ways to do that would usually imply to use a List rather than an array.
thanks a lot; thought there is something like sort.listname, or something similar that is shorter 🙂
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@232222326022864897>.