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 are the differences between the java collection and the java list? : java collections
What are the main classes of the list interfaces? : java collections
What are the different types of features of the java collections framework? : java collections
What is the enumerator of the java collection framework? : java collections
How do I find jre path in windows?
What are the interfaces in java collections? : java collections
What is an algorithm in java collection framework? : java collections
Hi we have an urgent requirement for Java/J2ee technical lead position & also looking for "Java Guidewire claimcentre" experienced professional for Bangalore location if interested can reach srisanh@gmail.com
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 are the classes in the java collection framework? : java collections
What are the uses of the set interfaces in the java collections? : java collections
Should we create system software ( e.g operating system ) in java ?
who will give req's to u?. how they send req's to u? . what design documents contains?. when bugs raised on other developer code how to report to them?.(throgh mail or ........). how to retrive 100 recods from dao layer to presentation layer.using which collection?. what is sequence diagram.?.
what is mean by hasing and maping in java platform and advantage?
What are the different types of collections views being provided by the map interface? : java collections