Question 6 [9]
6.1 In what situations (in general) would you use a
TreeMap? (3)
6.2 In what situations (in general) would you use a HashSet
to store a collection of
values?
Answer Posted / ashima
TeeMap is used when the data is to be stored in a sorted
order of the keys.
HashSet is used when it is not required to store the data
in the sroted order. Also, the insertion, deletion and
selection is faster in HashSet.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to reverse string in java?
How we create object in copy constructor?
What do you know about the garbage collector?
Write a program to find the whether a number is an Armstrong number or not?
Explain an algorithm to find depth of a binary tree.
How many wrapper classes are there in java?
What are synchronized methods and synchronized statements in java programming?
Why charat is used in java?
What is native code?
What is the difference between the ">>" and " >>>" operators in java?
What are drawbacks of singleton class?
How do you clear a method in java?
why would you use a synchronized block vs. Synchronized method? : Java thread
What is return in java?
I don’t want my class to be inherited by any other class. What should I do?