标题: LinkedList转ArrayList [打印本页] 作者: ringfingers 时间: 2015-10-10 23:54 标题: LinkedList转ArrayList public static void main(String[] args) {
// add elements
int size = 2000000;
List<String> list = new ArrayList<String>();
for (int i = 0; i < size; i++) {
list.add("Just some test data");
}
long startTime = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
list.get(i);
if (i % 10000 == 0) {
System.out.println("query 10000 elements spend: "
+ (System.currentTimeMillis() - startTime));
startTime = System.currentTimeMillis();
}
}
} 作者: ringfingers 时间: 2015-10-10 23:58
0.0..0.0.0..0.0.0..0.0..0.0.0..0.0.0..0.0.0.0