Question: In Java: TheSimpleSetclass shall be written with Generics in order to allow Sets that can hold a variety of different data types Data Fields: TheSimpleSetclass

In Java: TheSimpleSetclass shall be written with Generics in order to allow Sets that can hold a variety of different data types

Data Fields:

TheSimpleSetclass shall have a private data field which is an array of 10 elements to store each element of the Set. This array will be fixed at 10 and WILL NOT resize itself. We are creating a very simple set to hold only 10 items.TheSimpleSetclass shall have a private data field that is an integer which holds the current size of the set. The size will increase as new items are added to the set.TheSimpleSetclass shall haveno other data fields.

Constructors:

TheSimpleSetclass shall have a no argument constructor to create a new, empty instance ofSimpleSet.TheSimpleSetclass shall have another constructor that will accept a comma separated list of items to initialize the set. The following would be two examples of invoking this constructor: SimpleSet s1 = new SimpleSet<>(1, 2, 3, 4, 5); SimpleSet s2 = new SimpleSet<>("dog", "cat", "mouse"); NOTE: The comma separated lists can include anywhere between 1 and 10 values. If you do not remember how to create a parameter of this type, do some research on "variable-length parameter lists".TheSimpleSetclass shall haveno other constructors.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!