数据项目结构为
public Item(String id, String content, String details) {
this.id = id;
this.content = content;
this.details = details;
}
现在有100个值,想初始化到ArrayList
list.add(new Item('key','digest','detail');
...
这样写比较麻烦,有没有简便一点的写法?
Arrays.asList()
但是你还要new 100个Item。
把内容写到某个地方,然后用个代码来创建。