API feature request: get members of a list

4 views
Skip to first unread message

George Ludwig

unread,
May 15, 2011, 3:33:39 PM5/15/11
to jt...@googlegroups.com
Daniel,

I'm writing code to walk the lists that a user has created, and get information on each member of each list. Right now, it looks like there is no JTwitter API call to get the members of a list, only subscribers to the list.

It would be great if there was a method in TwitterList like: Iterator<Twitter.User> getMembers() 

I've found the Iterator pattern to be extremely useful in cases where you are accessing a potentially unbounded result set (i.e., crawling the web), or a result set that is created via repeated calls (i.e., calls to the Twitter API to fetch packets of users).

I'd be happy to contribute to this (and other similar features) if you're short on time!

Best,

George

Daniel Winterstein

unread,
May 16, 2011, 8:27:50 AM5/16/11
to jt...@googlegroups.com
Hi George,

Thanks for the offer to help. In fact those methods are already there,
due to extending AbstractList. A TwitterList _is_ a list of its
members.
So you can do, e.g.

TwitterList twitterList = ...;
// loop over members
for(User user : twitterList) {

}

This will call Twitter as needed to pull down the pages of the list.
If you're interested in the underlying code, the key methods are get()
and size() - AbstractList provides the rest.

Best regards,
- Daniel

--
--------------------------------------------------
Daniel Winterstein
Edinburgh
http://winterwell.com   http://soda.sh

Reply all
Reply to author
Forward
0 new messages