// TODO: this is inefficient
Map<String, UserList> lists = new HashMap<String, UserList>();
for (UserList l : getUserLists(user)) {
lists.put(l.getName(), l);
}
final UserList list = lists.get(listId);
if (null == list) {
throw new TwitterClientException("no such list: " + listId + " owned by user " + user);
}
List<User> result = new LinkedList<User>();
for (twitter4j.User u : asList(new ListGenerator<twitter4j.User>() {
public PagableResponseList getList(long cursor) throws TwitterException {
return twitter.getUserListMembers(list.getId(), cursor);
}
})) {
result.add(new User(u));
}