}
public static Set<Tweet> getTweetStream(Long userId,
Set<TwitterUser> followingIds) {
DatabaseManager da = DatabaseManager.getInstance();
SimpleTwitterCriteria criteria = SimpleTwitterCriteria.instance();
SimpleTwitterCriterion[] criterionList = new SimpleTwitterCriterion[(followingIds
.size() + 1)];
criterionList[0] = SimpleTwitterCriterion.eq("twitterUser.objId",
userId);
int i = 1;
for (TwitterUser fuser : followingIds) {
criterionList[i] = SimpleTwitterCriterion.eq("twitterUser.objId",
fuser.getObjId());
i++;
}
criteria.add(SimpleTwitterCriterion.or(criterionList));
List<Tweet> allObjects = da.getAllObjects(Tweet.class, criteria);
Collections.sort(allObjects, new Comparator<Tweet>() {
@Override
public int compare(Tweet o1, Tweet o2) {
return o2.getDateCreated().compareTo(o1.getDateCreated());