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 are the different types of ways where you can iterate over a list? : java collections
Explain JSP life cycle?
Q1. A. Write note on "The class path Environment Variable". B. Which are different kinds of source code? Q2. A. How to create an interface? B. Why convert an applet to an application? Q3. A. How to use Media tracker Class. B. How to use string tokenizer class. Q4. A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on "The properties class" Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.
What is java collection? : java collections
What is the Spring2.5 MVC Navigation flow?
What are the types of the main implementing classes in the map interfaces? : java collections
what is difference between web server and application server?
can u draw class/object diagram for ATM
0 Answers HCL, Zycus Infotech,
What are the different types of features of the java collections framework? : java collections
Which is the better framework for web applications, struts or spring, and why?
What are the differences between the java collection and the java list? : java collections
what debugging tool that can be used to debug the java programs?