Quantcast
Channel: Java how to order a List in alphabetical order by one of its elements - Stack Overflow
Viewing all articles
Browse latest Browse all 3

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

$
0
0

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 most recent people that the user followed but not in alphabetical order which is what I want, is there a way that I can essentially take a list of lists and sort the entire list based one one specific element in the list?

EDIT: sorry totally forgot to add in my code, my apologies

long cursor = -1;        List<User> users = new ArrayList<User>();        try {            PagableResponseList<User> userGroups = null;            do {                userGroups = twitter.getFriendsList(app.getUserId(), cursor);                for (User user : userGroups) {                    users.add(user);                }            } while ((cursor = userGroups.getNextCursor()) != 0);        } catch (TwitterException e) {            // TODO Auto-generated catch block            e.printStackTrace();        }

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images