Quantcast
Channel: Java how to order a List in alphabetical order by one of its elements - Stack Overflow
Browsing index pages (3 articles)
↧

Java how to order a List in alphabetical order by one of its elements

I am attempting to add in a users friend list into my application so that they can quickly find people that they follow on twitter, currently I am able to do this but the results come back based on the...

View Article


Answer by Gilbert Le Blanc for Java how to order a List in alphabetical order...

Change your List to a SetSet<User> users = new TreeSet<User>();This assumes that your Users are unique.You may have to wrap the User class with your own class so you can write your own...

View Article


Answer by Jave for Java how to order a List in alphabetical order by one of...

Use the Collections.sort() method. You will have to create a custom Comparator for this, but there are many available tutorials on this.What you basically do is you subclass the Comparator to compare...

View Article
Browsing index pages (3 articles)


Latest Images