Solved

HashSet and TreeSet

Posted on 2011-09-07
2
282 Views
Last Modified: 2012-05-12
I wouldd like to know about HashSet and TreeSet.

I read TreeSet we can add only similar type of object whereas in HashSet we can add any type of objects. I was not clear on that. When, how, why we use each of them. thanks in advance
0
Comment
Question by:gudii9
  • 2
2 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36495713
TreeSet is always  ordered - so the method to compare elements with each other should be defined for the elements, no if they are completely different it is hardly possible
HashSet is not ordered - so all different objects can be elements of the same HashSet
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36495879
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now