Question: Hi please help with Java task Need to write generic methods with this collection ArrayList, LinkedList, HashSet,TreeSet and then test everything in RunnerClass. All methods

Hi please help with Java task

Need to write generic methods with this collection ArrayList, LinkedList, HashSet,TreeSet and then test everything in RunnerClass.

All methods need to be generic

For example all methods looks like this one, thats example :

public  void ensure(ArrayList list, int value){ list.ensureCapacity(value)

ArrayList:

1.Method that replaces the third element of the ArrayList passed in the argument with another element (also passed in the argument)

2.Method that will increase the size of a given ArrayList by the specified value.

3.Method that will trim the capacity of the ArrayList to the number of elements it currently has.

4.Method that will clear the given ArrayList.

LinkedList:

1.Method that inserts a given item into the selected LinkedList index.

2.Method that checks weather the given element exist in LinkedList.

3.Method that will check weather a given LinkedList is empty or not.

4.Method that will return a LinkedList, the method is to compare the elements of two LinkedLists - if two Linked Lists have all, e.g. 3 elements the same. Linked List The result list should look like this: [true, true, true]

HashSet:

1.Method that will compar two set and return a collection of only those items that are common to both sets.

2. Method that will compare two HashSet- method is supposed to return boolean.

TreeSet:

1.Method that will return and remove the last element of the TreeSet passed in the argument.

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!