Time for 10,000 insertions

  • 2
  • Locked
Time is our most valuable resource. But we don't have any power over time anywhere, except on the planet of Tralfamadore. That's why there are no programmers on Tralfamadore, while Terra is full of them—because they help other people save time. Let's celebrate automation by measuring how long it takes to perform 10,000 insertions on a LinkedList and an ArrayList.
You can't complete this task, because you're not signed in.
Comments (7)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Marek Pasierbek Working at Nexus Polska
14 July 2020, 07:09
Try do ii with 100000 items..... 694 vs 4 miliseconds.
Nickolas Johnson
Level 8 , St. Louis, United States of America
9 April 2020, 15:09
Wow that's uhh, fast. I was expecting the numbers returned to be much higher.
Justin Smith
Level 8 , United States
25 November 2019, 18:49
For anyone wondering, the Date class is deprecated.
long time = System.currentTimeMillis();
Use that instead.
carlos oliveira
Level 10 , Seattle, United States
13 November 2021, 03:03
thanks Justin
Lukas Smetana
Level 10 , London, United Kingdom
7 August 2019, 11:22
If you run it more than once you will get different outputs. Like 14 and 2 , 15 and 2 , 16 and 4, etc. Can anyone explain why?
Mateo
Level 26 , Zagreb, Croatia
19 March 2019, 14:13
LinkedList is a lot faster ;)
Mihai Bone
Level 8 , Bucharest, Romania
22 December 2020, 22:23
:D You destroy the hole purpose of the task :D