📄 listget.java
字号:
package net.betterjava.collection.performance.list;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
public class ListGet extends AbstractListTest {
public ListGet() {
super();
int[][] i = { { 1, 1000, 1000, 1000, 1000 }, {
1, 1000, 1000, 1000, 2000 }, {
1, 1000, 1000, 1000, 3000 }, {
1, 1000, 1000, 1000, 4000 }, {
1, 1000, 1000, 1000, 5000 }
};
this.setLoopTable(i);
}
protected long runTestBody(int rpts, List innerList) {
Collection c = Collections.nCopies(rpts, "");
innerList.addAll(c);
long elapse = System.currentTimeMillis();
for (int j = 0; j < rpts; j++) {
innerList.get(j);
}
return System.currentTimeMillis() - elapse;
}
public static void main(String[] args) {
AbstractListTest test = new ListGet();
test.run();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -