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
JavaBot
JavaBot3d ago
This post has been reserved for your question.
Hey @orbankaroly! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Kyo-chan
Kyo-chan3d ago
Looks good enough. "More elegant" ways to do that would usually imply to use a List rather than an array.
orbankaroly
orbankarolyOP2d ago
thanks a lot; thought there is something like sort.listname, or something similar that is shorter 🙂
JavaBot
JavaBot2d ago
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.
JavaBot
JavaBot2d ago
Post Closed
This post has been closed by <@232222326022864897>.
Want results from more Discord servers?
Add your server