Question: MyArrayList is defined in Listing 24.2. Write a program that generates 1000000 random double values between 0 and 999999 and stores them in a MyArrayList
MyArrayList is defined in Listing 24.2. Write a program that generates 1000000 random double values between 0 and 999999 and stores them in a MyArrayList and in a MyHashSet. Generate a list of 1000000 random double values between 0 and 1999999. For each number in the list, test if it is in the array list and in the hash set. Run your program to display the total test time for the array list and for the hash set.
Data from Listing 24.2.

![INITIAL CAPACITY = 16: private E[] data = (E[]) new Object[INITIAL CAPACITY]:](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1620/1/2/6/63460912baa597b91620126633296.jpg)


1 publ1c class MyArrayList 1mplementS MyList { publ1c stat 1c f1nal 1nt INITIAL CAPACITY = 16: private E[] data = (E[]) new Object[INITIAL CAPACITY]: private int size = 0: // Number of elements in the list 2 3 4 5 6 ** Create an empty list / 7 pub11c MyArrayList () { 9 10 * Create a list from an array of objects /
Step by Step Solution
3.41 Rating (173 Votes )
There are 3 Steps involved in it
import javautilScanner import javautil public class Exercise2710 public static void mainString args MyHashSet set new MyHashSet MyArrayList list new MyArrayList for int i 0 i 1000000 i double value Ma... View full answer
Get step-by-step solutions from verified subject matter experts
