Search in sources :

Example 16 with JSONArray

use of weibo4j.org.json.JSONArray in project twitter-2-weibo by rjyo.

the class UserTrend method constructTrendList.

public static List<UserTrend> constructTrendList(Response res) throws WeiboException {
    try {
        JSONArray list = res.asJSONArray();
        int size = list.length();
        List<UserTrend> trends = new ArrayList<UserTrend>(size);
        for (int i = 0; i < size; i++) {
            trends.add(new UserTrend(list.getJSONObject(i)));
        }
        return trends;
    } catch (JSONException jsone) {
        throw new WeiboException(jsone);
    } catch (WeiboException te) {
        throw te;
    }
}
Also used : JSONArray(weibo4j.org.json.JSONArray) ArrayList(java.util.ArrayList) JSONException(weibo4j.org.json.JSONException)

Aggregations

JSONArray (weibo4j.org.json.JSONArray)16 JSONException (weibo4j.org.json.JSONException)16 ArrayList (java.util.ArrayList)13 JSONObject (weibo4j.org.json.JSONObject)5 Date (java.util.Date)2 Iterator (java.util.Iterator)1