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 |
what is acl(access control list)?
Runining mutiple tomcat server in a single machine is possible Yuo wil have to duplicate configuration with different port numbers
Which is the better framework for web applications, struts or spring, and why?
what is filter ?
How is hashset maintained in memory by java ?
whats the relation ship between LDAP and JNDI?
how to delete cookie information?and when it will delete?
Which java collection class can be used to maintain the entries in the order in which they were last accessed?
what is the IDE that you have used to write your java programs?
2 Answers Inforica, Interface Software,
httt method
What is the Spring2.5 MVC Navigation flow?
What is the use of hashcode in java ?