public class TwitterList extends java.util.AbstractList<User>
The methods of this object will call Twitter when they need to, and store the
results. E.g. the first call to size()
might require a call to
Twitter, but subsequent calls will not.
WARNING: Twitter only returns list members in batches of 20. So reading a large list can be slow and use quite a few calls to Twitter.
To find out what lists you or another user has, see
Twitter.getLists()
and Twitter.getLists(String)
.
To find out what lists you or another user are *in*, see
Twitter.getListsContainingMe()
and
Twitter.getListsContaining(String, boolean)
.
Twitter
Constructor and Description |
---|
TwitterList(java.lang.Number id,
Twitter jtwit) |
TwitterList(java.lang.String ownerScreenName,
java.lang.String slug,
Twitter jtwit)
Deprecated.
Due to the potential for confusion with
TwitterList(String, Twitter, boolean, String) Use
get(String, String, Twitter) instead. |
TwitterList(java.lang.String listName,
Twitter jtwit,
boolean isPublic,
java.lang.String description)
CREATE a brand new Twitter list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(User user)
Add a user to the list.
|
boolean |
addAll(java.util.Collection<? extends User> newUsers) |
void |
delete()
Delete this list!
|
User |
get(int index) |
static TwitterList |
get(java.lang.Number id,
Twitter jtwit)
A lazy-loading list viewer.
|
static TwitterList |
get(java.lang.String ownerScreenName,
java.lang.String slug,
Twitter jtwit)
A lazy-loading list viewer.
|
java.lang.String |
getDescription() |
java.lang.Number |
getId() |
java.lang.String |
getName() |
User |
getOwner() |
java.util.List<Status> |
getStatuses()
Returns a list of statuses from this list.
|
int |
getSubscriberCount() |
java.util.List<User> |
getSubscribers() |
boolean |
isPrivate() |
boolean |
remove(java.lang.Object o)
Remove a user from the list.
|
void |
setDescription(java.lang.String description) |
void |
setPrivate(boolean isPrivate) |
int |
size() |
java.lang.String |
toString() |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
@Deprecated public TwitterList(java.lang.String ownerScreenName, java.lang.String slug, Twitter jtwit)
TwitterList(String, Twitter, boolean, String)
Use
get(String, String, Twitter)
instead.owner
- .screenName The Twitter screen-name for the list's owner.slug
- The list's name. Technically the slug and the name needn't be
the same, but they usually are.jtwit
- a JTwitter object (this must be able to authenticate).Twitter.Exception.E404
- if the list does not existwhich creates new
lists.
public TwitterList(java.lang.String listName, Twitter jtwit, boolean isPublic, java.lang.String description)
listName
- The list's name.jtwit
- a JTwitter object (this must be able to authenticate).description
- A description for this list. Can be null.which views existing lists.
public TwitterList(java.lang.Number id, Twitter jtwit)
public static TwitterList get(java.lang.String ownerScreenName, java.lang.String slug, Twitter jtwit)
ownerScreenName
- owner
- .screenName The Twitter screen-name for the list's owner.slug
- The list's name. Technically the slug and the name needn't be
the same, but they usually are.jtwit
- a JTwitter object (this must be able to authenticate).Twitter.Exception.E404
- if the list does not existpublic static TwitterList get(java.lang.Number id, Twitter jtwit)
id
- jtwit
- a JTwitter object (this must be able to authenticate).Twitter.Exception.E404
- if the list does not existpublic boolean add(User user)
public boolean addAll(java.util.Collection<? extends User> newUsers)
public void delete()
TwitterException
- on failurepublic User get(int index)
public java.lang.String getDescription()
public java.lang.Number getId()
public java.lang.String getName()
public User getOwner()
public java.util.List<Status> getStatuses() throws TwitterException
This uses the "standardish" settings in JTwitter -- eg include RTs and since-id
TwitterException
public int getSubscriberCount()
public java.util.List<User> getSubscribers()
public boolean isPrivate()
public boolean remove(java.lang.Object o)
public void setDescription(java.lang.String description)
public void setPrivate(boolean isPrivate)
public int size()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<User>