fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int testCount = 1000000;
  13. test(testCount);
  14. test(testCount);
  15. test(testCount);
  16. test(testCount);
  17. test(testCount);
  18. test(testCount);
  19. test(testCount);
  20. test(testCount);
  21. test(testCount);
  22. }
  23. public static void test(int test) {
  24. List list = new LinkedList();
  25. long start = System.currentTimeMillis();
  26. for (int i = 0; i< test; i++) {
  27. list.add(0, i);
  28. }
  29. long finish = System.currentTimeMillis();
  30. System.out.println("time " + (finish-start));
  31. }
  32. }
Success #stdin #stdout 4s 320320KB
stdin
Standard input is empty
stdout
time  476
time  517
time  439
time  430
time  418
time  408
time  384
time  456
time  367