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
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
Thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started