if (key.length() == 19) { trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd HH:mm:ss"), trendsArray)); } else if (key.length() == 16) { trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd HH:mm"), trendsArray)); } else if (key.length() == 10) { trends.add(new Trends(res, asOf, parseDate(key , "yyyy-MM-dd"), trendsArray));
static Trends constructTrends(Response res) throws TwitterException { JSONObject json = res.asJSONObject(); try { Date asOf = parseDate(json.getString("as_of")); JSONArray array = json.getJSONArray("trends"); Trend[] trendsArray = jsonArrayToTrendArray(array); return new Trends(res, asOf, asOf, trendsArray); } catch (JSONException jsone) { throw new TwitterException(jsone.getMessage() + ":" + res.asString(), jsone); } }