如何从方法的中间元素到ArrayList

时间:2012-06-21 08:36:29

标签: java arraylist ical4j

这是方法,我从不同的URL获取多个列表,然后将不同的List排序到单个ArrayList中。来自不同日历的Arraylist具有不同的EMAIL和OWNER NAME。在这个方法中,我只返回一个ArrayList。如何获取每个ArrayList的EMAIL和OWNNER NAME?。

public List<ArrayList> getEventsSort(Filter filter, String uri, Sardine sardine,
    List<String> emailShare) throws IOException, ParserException {
List eventsToday = null;
List arrayList = new ArrayList<String>();
for (String email : emailShare) {
    String uris = uri + email + "/events/";
    InputStream stream = null;
    try {
        stream = sardine.get(uris);
        BufferedReader br = new BufferedReader(new InputStreamReader(
                stream));
        CalendarBuilder builder = new CalendarBuilder();
        net.fortuna.ical4j.model.Calendar calendar = builder.build(br);
        eventsToday = (List<?>) filter.filter(calendar
                .getComponents(Component.VEVENT));  
        arrayList.addAll(eventsToday);
    } finally {
        IOUtils.closeQuietly(stream);
    }
}

    getSortList(arrayList);
return arrayList;

}

1 个答案:

答案 0 :(得分:1)

您可以通过创建存储3个变量(电子邮件,源名称和源电子邮件ID)的类对象的数组列表来实现此目的