Search Interview Questions
| 2784 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Core java - Interview Questions and Answers for 'Mist minds technologies' - 1 question(s) found - Order By Newest|
|Ans. 1. HashSet doesnt maintain its elements in any specific order and is all random whereas TreeSet maintains elements in natural order 9 order defined by the equals method of TreeSet element type )|
2. TreeSet doesnt allow null elements whereas HashMap does.
3. As TreeSet orders elements and is hence insertion is comparatively slower.
4. HashSet performs basic operations like add(), remove(), contains(), size() etc. in a constant size time. A TreeSet performs these operations at the order of log(n) time.
5. HashMap in Java internally backs a HashSet. A NavigableMap backs a TreeSet internally.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve collections hashset treeset set HCL Technologies AppKnox Pramati Technologies Mist Minds Technologies Basic   frequent|
Try 1 Question(s) Test
|Difference between TreeMap and HashMap ?|
| Which of the following collections stores its elements in insertion Order ? |
|What is reflection ?|
|What is comparator interface used for ?|
|If I try to add Enum constants to a TreeSet, What sorting order will it use ?|
|Which of the following collection maintain its elements in Natural Sorted order ?|
|What is a binary tree ?|
|What are the phases of the JSP life cycle ?|
|Which are the sorted collections ?|