我在数组中有一组数据,并希望将其转换为列表或将数据添加到列表中。粘滞头库使用列表,我需要将我的列表更改为列表,因为我很难将粘贴头用作数组,它只显示空白的回收站视图。
这是我的一组示例数据,这是数据仅用于在日历中创建新事件。我检索当天并将其格式化以显示(例如星期一)。这就是标题。
如果有人可以帮助将此数组转换为列表或如何将这些数据添加到列表中,那么我们将不胜感激,或者如果某人熟悉粘贴头并使用了数组,则可以使用一些示例代码。
public static final Event[] EventList = {
new Event("The Theory of Everything", "1:00 PM", "Cinema 1", 2015, 2, 5, 13, 0),
new Event("Kingsman the Secret Service", "3:00 PM", "Cinema 2", 2015, 2, 5, 15, 0),
new Event("Fifty Shades of Grey", "5:00 PM", "Cinema 3", 2015, 2, 5, 17, 0),
new Event("Focus", "7:00 PM", "Cinema 4", 2015, 2, 5, 19, 0),
new Event("Crazy Beautiful You", "9:00 PM", "Cinema 5", 2015, 2, 5, 21, 0),
new Event("The Theory of Everything", "1:00 PM", "Cinema 1", 2015, 2, 6, 13, 0),
new Event("Kingsman the Secret Service", "3:00 PM", "Cinema 2", 2015, 2, 6, 15, 0),
new Event("Fifty Shades of Grey", "5:00 PM", "Cinema 3", 2015, 2, 6, 17, 0),
new Event("Focus", "7:00 PM", "Cinema 4", 2015, 2, 6, 19, 0),
new Event("Crazy Beautiful You", "9:00 PM", "Cinema 5", 2015, 2, 6, 21, 0)
};
答案 0 :(得分:1)
你几乎就在那里。之后你可以这样做:
List<Event> eventList = Arrays.asList(EventList);