【发布时间】:2013-05-31 22:50:15
【问题描述】:
我有一个List<String>,其中有近 20,000 条记录(可能更多)...
我需要遍历这个列表,大约需要 3 分钟...
这是我的代码块:
for (String string : list) {
response += string;
response += "/t";
}
我有两个问题:
- 长时间是List迭代还是每个item的操作?
- 根据对问题 1 的回答,如何加快此操作?
【问题讨论】:
标签: java string performance list loops