Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago