Question: Hi Please help me with Java task Need to write generic methods with this collection HashMap, TreeMap and then test everything in RunnerClass All methods
Hi
Please help me with Java task
Need to write generic methods with this collection HashMap, TreeMap and then test everything in RunnerClass
All methods need to be generic
For example all methods looks like this one below , thats example for ArrayList methods :
-Method that will clear the given ArrayList:
public void ensure(ArrayList list, int value){ list.ensureCapacity(value)
In this example above, bolt the generic methods for HashMap and TreeMap
HashMap
1. Method that will return a shallow copy of the HashMap.
2. Method that will complete the HashMapa given as the first argument with elements from the HashMap given as the second argument
Thanks
TreeMap
1. Method that will return the first key at least equal to or greater than the key passed in the argument (if such a key does not exist, it will return the next higher one);
2. Method that will return a SortedMap containing part of the TreeMapa where the keys are greater or equal to the key given as argument
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
