In HashSet duplicates are allowed while adding to the HashSet,
but while retreiving the object from HashSet is not shown the
duplicate values, WHY ?
Answer Posted / 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 |
Post New Answer View All Answers
What do you understand by synchronization? Why is it important?
What are the different types of ways where you can iterate over a list? : java collections
What are the different types of classes implemented in the set interfaces? : java collections
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 ?
Hi Friends , am newbie to ajax. For example just consider one account registration - A form contains 8 text fields with submit button. In this form second texbox contains "username " . On right side of text box there is a label box . On clilck action i need to determine user is available or not. Is it possible on clicking label or should i click submit button.
my interviewer asked me what technical specification you used how to answer that question
Explain the OOPS concept in Realtime Scenarion ? Take example as CAR. Please explain indetail ?
What are the main classes of the list interfaces? : java collections
Which interface does java.util.hashtable implement?
What is the Spring2.5 MVC Navigation flow?
What are the queues in the java collection framework? : java collections
What are the types of interface used in the java collections? : java collections
What are the different types of features of the java collections framework? : java collections
what is mean by hasing and maping in java platform and advantage?
What is an algorithm in java collection framework? : java collections