Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public static void main(String[] args) {
  2. MyArrayList list = new MyArrayList(100000);
  3.  
  4. int i = 0;
  5. while(i<10){
  6. list.insertItem((int) (Math.random() * 100), list.getSize());
  7. i = i + 1;
  8. }
  9. list.display();
  10.  
  11. System.out.println( "Item at index 2 = " + list.getItem(2));
  12. // System.out.println( "Item at index 200000 = " + list.getItem(200000));
  13.  
  14. System.out.println("Inserting 999 at position 5");
  15. list.insertItem(999, 5);
  16. list.display();
  17.  
  18. System.out.println("Deleting from position 2");
  19. list.removeItem(2);
  20. list.display();
  21.  
  22. randomAccessPerformanceDemo(list, 20, list.getCapacity());
  23. insertPerformanceDemo(list, 20, list.getCapacity());
  24. removePerformanceDemo(list, 20, list.getCapacity());
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement