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>();
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|
which book is the best for preparing for SCWCD 1.5
i need java 1+ experience resume on java developer kindly send me my mail id:firstname.lastname@example.org
whatis arguments &what is default argument
can u draw class/object diagram for ATM
How to implement or use the singleton class in java?
What is the Spring2.5 MVC Navigation flow?
what is acl(access control list)?
when exactly should we use throws ,and wen exactly should we use the try and catch for exceptional handling
What is an Ioc pattern? There are assemblies in .net for establishing this task, Whats the special in Java /j2ee technologies about IOC
Can any one tell me How to explain bank project desription in interview
what is the difference between checked and unchecked Exceptions?