In HashSet duplicates are allowed while adding to the HashSet,
but while retreiving the object from HashSet is not shown the
duplicate values, WHY ?
Answers were Sorted based on User's Feedback
Answer / brijendra kumar (xavient)
Actually in HashSet we are able to add the duplicate value,
but at the execution time JVM ignore the duplicate value.
HashSet<String> T= new HashSet<String>();
T.add("k");
T.add("k");
System.out.println("size" +T.size());
when we execute these line of code then we got the size of
HashSet is 1.
Due to this reason we are unable to iterate the duplicate
value from HashSet.
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / shashi
Because HashSet class will override equals and hashcode method internally.
| Is This Answer Correct ? | 0 Yes | 0 No |
In hyderabad, which s/w training center is best for java, other than corejava what r the new tools to learn in java,which tool is best & have current requirement,pls give me information about java to learn ?
what is the difference between through and throws?
How to use ANT?
Which of the following declaration is wrong? int i=45; float j = 45.0; double k=45.0;
what about web architecture?
How to implement or use the singleton class in java?
Hi frnds how to lock an user when he enter wrong credentials more than 3 time using java or j2ee tech take username and password in a bean no need to connect DB and validate give me some sample application code or links its urgent for me thanks in advance
What are the classes in the java collection framework? : java collections
what is difference between vector and arraylist?.
Why do you use Context Object
What are the different types of features of the java collections framework? : java collections
Runining mutiple tomcat server in a single machine is possible Yuo wil have to duplicate configuration with different port numbers