I will create a method to see how long it takes to create 10000 ArrayList
and < Code> LinkedList . What am I watching?
public class solutions {public static zero main (string [] args) {System.out.println (getTimeMsOfInsert (new Arrayist)); System.out.println (getTimeMsOfInsert (new linked list ()); } Public stable long getTimeMsOfInsert (list list) {insert10000 (list); } Enter the public static zero 10000 (list list) {for (ii = 0; i & lt; 10000; i ++) {list.add (0, new object ()); }}}}
Your code contains a compilation errors
, So I decided them and said that some code can help you.
You can do this:
public class solutions {public static zero main (string [] args) {System.out.println (getTimeMsOfInsert (new ArrayList () )); System.out.println (getTimeMsOfInsert (new linked list ()); } Public stable long getTimeMsOfInsert (list list) {return getInsertTime (list); } Get public static long timeInstantime (list list) {Long start = System.currentTimeMillis (); For (int i = 0; i <10000; i ++) {list.add (new object ()); } Return system. CurentimeMillis () - Starting; }}
Comments
Post a Comment