public static void checkListDeleteFirstSpeed(int quantity) { ArrayList testAL = createArrayList(quantity); Console.WriteLine("Procesing (with ArrayList). Please wait... \n"); stopWatchAL.Restart(); testAL.RemoveAt(0); stopWatchAL.Stop(); tsAL = stopWatchAL.Elapsed; string elapsedTimeAL = String.Format("{0:00}.{1:000}", tsAL.Seconds, tsAL.Milliseconds); ArrayListUtils.printReportAL(elapsedTimeAL); }
public static void checkListInsertAtBeginningSpeed(int quantity, int newQuantity) { ArrayList testAL = createArrayList(quantity); Console.WriteLine("Procesing (with ArrayList). Please wait... \n"); stopWatchAL.Restart(); for (int i = 0; i < newQuantity; i++) { var a = new Temp(i, i, i, i); testAL.Insert(i, a); } stopWatchAL.Stop(); tsAL = stopWatchAL.Elapsed; string elapsedTimeAL = String.Format("{0:00}.{1:000}", tsAL.Seconds, tsAL.Milliseconds); ArrayListUtils.printReportAL(elapsedTimeAL); }
public static void listFindObjectSpeed(int quantity, int value) { ArrayList testAL = createArrayList(quantity); Console.WriteLine("Procesing (with ArrayList). Please wait... \n"); stopWatchAL.Restart(); foreach (Temp t in testAL) { if (t.i1 == value) { var index = testAL.IndexOf(t); break; } } stopWatchAL.Stop(); tsAL = stopWatchAL.Elapsed; string elapsedTimeAL = String.Format("{0:00}.{1:000}", tsAL.Seconds, tsAL.Milliseconds); ArrayListUtils.printReportAL(elapsedTimeAL); }